Skip to content

Commit

Permalink
remove unnecessary initializations
Browse files Browse the repository at this point in the history
  • Loading branch information
zak-pawel committed Oct 23, 2024
1 parent ebbc55f commit 1c0104e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 19 deletions.
2 changes: 1 addition & 1 deletion plugins/inputs/smart/smart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func TestGatherInParallelMode(t *testing.T) {
require.NoError(t, err)

result := acc.GetTelegrafMetrics()
testutil.RequireMetricsEqual(t, make([]telegraf.Metric, 0), result)
require.Empty(t, result)
})
}

Expand Down
1 change: 0 additions & 1 deletion plugins/inputs/snmp/snmp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,6 @@ func TestSnmpInit_noTranslateGosmi(t *testing.T) {
}},
},
ClientConfig: snmp.ClientConfig{
Path: make([]string, 0),
Translator: "gosmi",
},
}
Expand Down
9 changes: 4 additions & 5 deletions plugins/inputs/stackdriver/stackdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -714,11 +714,10 @@ func (s *stackdriver) addDistribution(dist *distributionpb.Distribution, tags ma
func init() {
inputs.Add("stackdriver", func() telegraf.Input {
return &stackdriver{
CacheTTL: defaultCacheTTL,
RateLimit: defaultRateLimit,
Delay: defaultDelay,
GatherRawDistributionBuckets: true,
DistributionAggregationAligners: make([]string, 0),
CacheTTL: defaultCacheTTL,
RateLimit: defaultRateLimit,
Delay: defaultDelay,
GatherRawDistributionBuckets: true,
}
})
}
9 changes: 4 additions & 5 deletions plugins/inputs/stackdriver/stackdriver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,10 @@ func (m *MockStackdriverClient) Close() error {

func TestInitAndRegister(t *testing.T) {
expected := &stackdriver{
CacheTTL: defaultCacheTTL,
RateLimit: defaultRateLimit,
Delay: defaultDelay,
GatherRawDistributionBuckets: true,
DistributionAggregationAligners: make([]string, 0),
CacheTTL: defaultCacheTTL,
RateLimit: defaultRateLimit,
Delay: defaultDelay,
GatherRawDistributionBuckets: true,
}
require.Equal(t, expected, inputs.Inputs["stackdriver"]())
}
Expand Down
8 changes: 2 additions & 6 deletions plugins/inputs/supervisor/supervisor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ func TestShort_SampleData(t *testing.T) {
for _, tC := range testCases {
t.Run(tC.desc, func(t *testing.T) {
s := &Supervisor{
Server: "http://example.org:9001/RPC2",
MetricsInc: make([]string, 0),
MetricsExc: make([]string, 0),
Server: "http://example.org:9001/RPC2",
}
status := supervisorInfo{
StateCode: tC.supervisorData.StateCode,
Expand Down Expand Up @@ -152,9 +150,7 @@ func TestIntegration_BasicGathering(t *testing.T) {
require.NoError(t, err, "failed to start container")
defer ctr.Terminate()
s := &Supervisor{
Server: "http://login:pass@" + testutil.GetLocalHost() + ":" + ctr.Ports[supervisorPort] + "/RPC2",
MetricsInc: make([]string, 0),
MetricsExc: make([]string, 0),
Server: "http://login:pass@" + testutil.GetLocalHost() + ":" + ctr.Ports[supervisorPort] + "/RPC2",
}
err = s.Init()
require.NoError(t, err, "failed to run Init function")
Expand Down
1 change: 0 additions & 1 deletion plugins/inputs/varnish/varnish.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ func init() {
UseSudo: false,
InstanceName: "",
Timeout: defaultTimeout,
Regexps: make([]string, 0),
}
})
}

0 comments on commit 1c0104e

Please sign in to comment.