Skip to content

Commit 20ee486

Browse files
authored
fix: flaky test (#968)
`TestConvertToStructs` was occasionally failing because it was expecting `range` over a `map` to be a consistent order, but per [spec]: > The iteration order over maps is not specified and is not guaranteed to be the same from one iteration to the next. Uses `ElementsMatch` so the test passes even when the order of elements is different. [spec]: https://go.dev/ref/spec#RangeClause
1 parent 92fff50 commit 20ee486

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

api/grpc/mpi/v1/helpers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func TestConvertToStructs(t *testing.T) {
6565
t.Run(tt.name, func(t *testing.T) {
6666
got, err := ConvertToStructs(tt.input)
6767

68-
assert.Equal(t, tt.expected, got)
68+
assert.ElementsMatch(t, tt.expected, got)
6969
assert.Equal(t, tt.wantErr, err != nil)
7070
})
7171
}

0 commit comments

Comments
 (0)