From f6cb49842f6b2264ce2cc12fed89e1fc3a51a806 Mon Sep 17 00:00:00 2001 From: Vlad Sirenko <821251+sirenko@users.noreply.github.com> Date: Sat, 21 Oct 2023 18:52:39 -0700 Subject: [PATCH] Fix the test --- core/services/telemetry/manager_test.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/core/services/telemetry/manager_test.go b/core/services/telemetry/manager_test.go index 93527f70435..2325c0d3b0f 100644 --- a/core/services/telemetry/manager_test.go +++ b/core/services/telemetry/manager_test.go @@ -332,10 +332,14 @@ func TestLegacyMode(t *testing.T) { require.Len(t, clientSent, 6) require.Equal(t, 1, obsLogs.Len()) // Deprecation warning for TelemetryIngress.URL and TelemetryIngress.ServerPubKey - require.Equal(t, []byte("endpoint-1-message-1"), clientSent[0].Telemetry) - require.Equal(t, []byte("endpoint-1-message-2"), clientSent[1].Telemetry) - require.Equal(t, []byte("endpoint-1-message-3"), clientSent[2].Telemetry) - require.Equal(t, []byte("endpoint-2-message-1"), clientSent[3].Telemetry) - require.Equal(t, []byte("endpoint-2-message-2"), clientSent[4].Telemetry) - require.Equal(t, []byte("endpoint-2-message-3"), clientSent[5].Telemetry) + // disable false positive linter, it misses the size check above + // nolint: gosec + if len(clientSent) >= 6 { + require.Equal(t, []byte("endpoint-1-message-1"), clientSent[0].Telemetry) + require.Equal(t, []byte("endpoint-1-message-2"), clientSent[1].Telemetry) + require.Equal(t, []byte("endpoint-1-message-3"), clientSent[2].Telemetry) + require.Equal(t, []byte("endpoint-2-message-1"), clientSent[3].Telemetry) + require.Equal(t, []byte("endpoint-2-message-2"), clientSent[4].Telemetry) + require.Equal(t, []byte("endpoint-2-message-3"), clientSent[5].Telemetry) + } }