Skip to content

Commit

Permalink
Fix Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
bonzofenix authored and Alan Fernando Moran committed May 21, 2024
1 parent 9f5b139 commit 6ec0348
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ lint: $(addprefix lint_,$(go_modules)) rubocop
rubocop:
@echo " - ruby scripts"
@bundle install
@bundle exec rubocop ./spec ./packages
@bundle exec rubocop ${RUBOCOP_OPTS} ./spec ./packages

.PHONY: markdownlint
markdownlint: markdownlint-cli
Expand Down
16 changes: 6 additions & 10 deletions spec/jobs/metricsforwarder/metricsforwarder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
it "supports syslog forwarding" do
properties["autoscaler"]["metricsforwarder"] = {
"syslog" => {
"server_address" => "syslog-server",
"server_address" => "syslog-server"
}
}

Expand All @@ -24,17 +24,16 @@
"syslog" => {
"server_address" => "syslog-server",
"port" => 6067,
"tls" => {
"tls" => {
"key_file" => "/var/vcap/jobs/loggr-syslog-agent/config/certs/syslog_agent.key",
"cert_file" => "/var/vcap/jobs/loggr-syslog-agent/config/certs/syslog_agent.crt",
"ca_file" => "/var/vcap/jobs/loggr-syslog-agent/config/certs/loggregator_ca.crt",
"ca_file" => "/var/vcap/jobs/loggr-syslog-agent/config/certs/loggregator_ca.crt"
}
}
}
)
end


it "does not set username nor password if not configured" do
properties["autoscaler"]["metricsforwarder"] = {
"health" => {
Expand Down Expand Up @@ -65,13 +64,10 @@
)
end


it "has a cred helper impl by default" do
expect(rendered_template).to include(
{
"cred_helper_impl" => "default"
}
)
expect(rendered_template).to include({
"cred_helper_impl" => "default"
})
end

it "has a cred helper impl configured for stored procedures" do
Expand Down
5 changes: 1 addition & 4 deletions src/acceptance/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,4 @@ test:
bin/test $(filter-out $@,$(MAKECMDGOALS))

lint:
@go run github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION} run

lint-fix:
go run github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION} run --fix
@cd ../../; make lint_acceptance OPTS=${OPTS}
1 change: 0 additions & 1 deletion src/autoscaler/metricsforwarder/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ func (c *Config) Validate() error {
if c.UsingSyslog() {
if c.SyslogConfig.TLS.CACertFile == "" {
return fmt.Errorf("Configuration error: SyslogServer Loggregator CACert is empty")

}
if c.SyslogConfig.TLS.CertFile == "" {
return fmt.Errorf("Configuration error: SyslogServer ClientCert is empty")
Expand Down
7 changes: 2 additions & 5 deletions src/autoscaler/metricsforwarder/forwarder/syslog_emitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ import (
)

type SyslogEmitter struct {
logger lager.Logger
netConf syslog.NetworkTimeoutConfig
Writer egress.WriteCloser
logger lager.Logger
Writer egress.WriteCloser
}

type Counter struct{}
Expand Down Expand Up @@ -77,7 +76,6 @@ func NewSyslogEmitter(logger lager.Logger, conf *config.Config) (MetricForwarder
}

func (mf *SyslogEmitter) EmitMetric(metric *models.CustomMetric) {

e := &loggregator_v2.Envelope{
InstanceId: fmt.Sprintf("%d", metric.InstanceIndex),
Timestamp: time.Now().UnixNano(),
Expand All @@ -98,5 +96,4 @@ func (mf *SyslogEmitter) EmitMetric(metric *models.CustomMetric) {
if err != nil {
mf.logger.Error("failed-to-write-metric-to-syslog", err)
}

}

0 comments on commit 6ec0348

Please sign in to comment.