From 34cc2ddee9a57db9a3563be5b4ebc57e458ad699 Mon Sep 17 00:00:00 2001 From: Bradley Jones Date: Wed, 3 Apr 2024 16:53:38 +0100 Subject: [PATCH] test: ensure slice ordering doesn't matter in test asserts Signed-off-by: Bradley Jones --- pkg/reporter/reporter_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/reporter/reporter_test.go b/pkg/reporter/reporter_test.go index 62f9680..5709bff 100644 --- a/pkg/reporter/reporter_test.go +++ b/pkg/reporter/reporter_test.go @@ -974,7 +974,13 @@ func TestNormalize(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { report, mod := Normalize(tt.args.report) - assert.Equal(t, tt.want, report) + assert.ElementsMatch(t, tt.want.Namespaces, report.Namespaces) + assert.ElementsMatch(t, tt.want.Nodes, report.Nodes) + assert.ElementsMatch(t, tt.want.Pods, report.Pods) + assert.ElementsMatch(t, tt.want.Containers, report.Containers) + assert.Equal(t, tt.want.ClusterName, report.ClusterName) + assert.Equal(t, tt.want.Timestamp, report.Timestamp) + assert.Equal(t, tt.want.ServerVersionMetadata, report.ServerVersionMetadata) assert.Equal(t, tt.modified, mod) }) }