Skip to content

Commit

Permalink
[chore][pkg/stanza] - Fix Flaky test TestMatcher (#36640)
Browse files Browse the repository at this point in the history
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`)
  • Loading branch information
VihasMakwana authored Dec 3, 2024
1 parent c04e2d4 commit 7abf152
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/stanza/fileconsumer/matcher/matcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ func TestMatcher(t *testing.T) {
} else {
assert.NoError(t, err)
}
assert.Equal(t, tc.expected, files)
assert.ElementsMatch(t, tc.expected, files)
})
}
}
Expand Down

0 comments on commit 7abf152

Please sign in to comment.