Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Thomas Casteleyn <thomas.casteleyn@me.com>
  • Loading branch information
adrianlzt and Hipska authored Nov 30, 2023
1 parent c94aa60 commit 266d774
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions plugins/outputs/zabbix/autoregister_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ func TestZabbixAutoregisterPush(t *testing.T) {
z.Autoregister = "autoregister"
z.autoregisterAdd("hostname")
z.autoregisterPush()
require.Equal(t, len(z.autoregisterLastSend), 1)
require.Equal(t, zabbixSender.hostname, "hostname")
require.Equal(t, zabbixSender.hostMetadata, "autoregister")
require.Len(t, z.autoregisterLastSend, 1)
require.Equal(t, "hostname", zabbixSender.hostname)
require.Equal(t, "autoregister", zabbixSender.hostMetadata)

// Test that autoregister is not sent if the last send was less than AutoregisterResendInterval ago.
z.Autoregister = "autoregister"
z.autoregisterAdd("hostname")
z.autoregisterLastSend["hostname"] = time.Now().Add(time.Hour)
zabbixSender.Reset()
z.autoregisterPush()
require.Equal(t, len(z.autoregisterLastSend), 1)
require.Len(t, z.autoregisterLastSend, 1)
require.Equal(t, "", zabbixSender.hostname)
require.Equal(t, "", zabbixSender.hostMetadata)

Expand All @@ -77,7 +77,7 @@ func TestZabbixAutoregisterPush(t *testing.T) {
z.autoregisterLastSend["hostname"] = time.Now().Add(-24 * time.Hour)
zabbixSender.Reset()
z.autoregisterPush()
require.Equal(t, len(z.autoregisterLastSend), 1)
require.Len(t, z.autoregisterLastSend, 1)
require.Equal(t, "hostname", zabbixSender.hostname)
require.Equal(t, "autoregister", zabbixSender.hostMetadata)
}
Expand Down

0 comments on commit 266d774

Please sign in to comment.