Skip to content

Commit

Permalink
sorting test results for deterministic results (#2325)
Browse files Browse the repository at this point in the history
  • Loading branch information
soneillf5 committed Jan 4, 2022
1 parent f33daeb commit 0173835
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1311,18 +1311,18 @@ func TestGetDosProtectedThatReferencedDosLogConf(t *testing.T) {
policyNamespace: "dev",
policyName: "dosLogConfTwo",
expected: []*v1beta1.DosProtectedResource{
dosProtectedWithLogConfTwo,
anotherDosProtectedWithLogConfTwo,
dosProtectedWithLogConfTwo,
},
msg: "return two referenced objects, from log conf reference with mixed namespaces",
},
}
for _, test := range tests {
resources := dosConf.GetDosProtectedThatReferencedDosLogConf(test.policyNamespace + "/" + test.policyName)
sort.SliceStable(resources, func(i, j int) bool {
return resources[i].Name < resources[j].Name
})
if diff := cmp.Diff(test.expected, resources); diff != "" {
sort.SliceStable(resources, func(i, j int) bool {
return resources[i].Name < resources[j].Name
})
t.Errorf("GetDosProtectedThatReferencedDosLogConf() returned unexpected result for the case of: %v (-want +got):\n%s", test.msg, diff)
}
}
Expand Down

0 comments on commit 0173835

Please sign in to comment.