Skip to content

Commit

Permalink
slices: don't modify missed input slice in test
Browse files Browse the repository at this point in the history
The commit below correctly identified that modifying the test input
makes the test flaky due to being dependent on the non-deterministic
ordering. However, it missed adding the work-around for the first test,
TestUnique.

Fixes: 32543a4 (slices: don't modify input slices in test)

Signed-off-by: David Bimmler <david.bimmler@isovalent.com>
  • Loading branch information
bimmlerd authored and tklauser committed Mar 5, 2024
1 parent 979ee6d commit 08d898d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/slices/slices_test.go
Expand Up @@ -55,7 +55,8 @@ var testCases = [...]struct {
func TestUnique(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
got := Unique(tc.input)
input := slices.Clone(tc.input)
got := Unique(input)
assert.ElementsMatch(t, tc.expected, got)
})
}
Expand Down

0 comments on commit 08d898d

Please sign in to comment.