Skip to content

[chore][pkg/stanza] - Fix Flaky test TestMatcher#36640

Merged
dmitryax merged 1 commit into
open-telemetry:mainfrom
VihasMakwana:fix-test-matcher
Dec 3, 2024
Merged

[chore][pkg/stanza] - Fix Flaky test TestMatcher#36640
dmitryax merged 1 commit into
open-telemetry:mainfrom
VihasMakwana:fix-test-matcher

Conversation

@VihasMakwana
Copy link
Copy Markdown
Contributor

Fixes #36623

We're using a map to store groups and we then do a for .. range over keys.

for _, groupedFiles := range groups {
groupResult, err := filter.Filter(groupedFiles, m.regex, m.filterOpts...)
if len(groupResult) == 0 {
return groupResult, errors.Join(err, errs)
}
result = append(result, groupResult...)
}

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)

Copy link
Copy Markdown
Contributor

@evan-bradley evan-bradley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thanks.

@VihasMakwana VihasMakwana requested a review from odubajDT December 3, 2024 16:07
@VihasMakwana
Copy link
Copy Markdown
Contributor Author

cc: @odubajDT can you take a look? this is related to your recent work on file groupings.

Copy link
Copy Markdown
Member

@dmitryax dmitryax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @VihasMakwana!

@dmitryax dmitryax merged commit 7abf152 into open-telemetry:main Dec 3, 2024
@github-actions github-actions Bot added this to the next release milestone Dec 3, 2024
shivanthzen pushed a commit to shivanthzen/opentelemetry-collector-contrib that referenced this pull request Dec 5, 2024
Fixes
open-telemetry#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
open-telemetry#36518
changed it to `assert.Equal`)
ZenoCC-Peng pushed a commit to ZenoCC-Peng/opentelemetry-collector-contrib that referenced this pull request Dec 6, 2024
Fixes
open-telemetry#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
open-telemetry#36518
changed it to `assert.Equal`)
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this pull request Dec 17, 2024
Fixes
open-telemetry#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
open-telemetry#36518
changed it to `assert.Equal`)
AkhigbeEromo pushed a commit to sematext/opentelemetry-collector-contrib that referenced this pull request Jan 13, 2025
Fixes
open-telemetry#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
open-telemetry#36518
changed it to `assert.Equal`)
zeck-ops pushed a commit to zeck-ops/opentelemetry-collector-contrib that referenced this pull request Apr 23, 2025
Fixes
open-telemetry#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
open-telemetry#36518
changed it to `assert.Equal`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg/stanza Skip Changelog PRs that do not require a CHANGELOG.md entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[pkg/stanza] Flaky test TestMatcher/Numeric_Sorting_with_grouping

4 participants