Skip to content

Commit aa81811

Browse files
committed
fix flaky test because of string list order
1 parent eb47476 commit aa81811

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

pkg/task/inspection/commonlogk8sauditv2/impl/grouper_tasks_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/GoogleCloudPlatform/khi/pkg/model/log"
2424
commonlogk8sauditv2_contract "github.com/GoogleCloudPlatform/khi/pkg/task/inspection/commonlogk8sauditv2/contract"
2525
"github.com/google/go-cmp/cmp"
26+
"github.com/google/go-cmp/cmp/cmpopts"
2627
)
2728

2829
type testScanTargetResourceInput struct {
@@ -341,7 +342,7 @@ kind: Binding`,
341342
got = append(got, gotPaths)
342343
}
343344

344-
if diff := cmp.Diff(got, tc.want); diff != "" {
345+
if diff := cmp.Diff(got, tc.want, cmpopts.SortSlices(func(a, b string) bool { return a < b })); diff != "" {
345346
t.Errorf("mismatch (-want +got): %s", diff)
346347
}
347348
})

0 commit comments

Comments
 (0)