Skip to content

Commit 7abf152

Browse files
authored
[chore][pkg/stanza] - Fix Flaky test TestMatcher (#36640)
Fixes #36623 We're using a map to store groups and we then do a `for .. range` over keys. https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/6119d51a5a85565c409bb225027d6d1ab353aecc/pkg/stanza/fileconsumer/matcher/matcher.go#L200-L206 For maps, the ordering of keys is not guaranteed. Hence, the check fails. We should instead check with `assert.ElementsMatch` (which was previously the case, but #36518 changed it to `assert.Equal`)
1 parent c04e2d4 commit 7abf152

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/stanza/fileconsumer/matcher/matcher_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ func TestMatcher(t *testing.T) {
853853
} else {
854854
assert.NoError(t, err)
855855
}
856-
assert.Equal(t, tc.expected, files)
856+
assert.ElementsMatch(t, tc.expected, files)
857857
})
858858
}
859859
}

0 commit comments

Comments
 (0)