Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(alertmanager): fix a flaky test #7123

Merged
merged 1 commit into from
Feb 16, 2025
Merged

Conversation

grandwizard28
Copy link
Collaborator

@grandwizard28 grandwizard28 commented Feb 16, 2025

Summary

fix a flaky test in alertmanager


Important

Fix flaky test in channel_test.go by using assert.JSONEq for JSON string comparison.

  • Test Fix:
    • In channel_test.go, replace assert.Equal with assert.JSONEq for comparing JSON strings in TestNewConfigFromChannels.
  • Dependencies:
    • Add github.com/go-openapi/strfmt v0.23.0 as a direct dependency in go.mod.
    • Remove github.com/go-openapi/strfmt v0.23.0 from indirect dependencies in go.mod.

This description was created by Ellipsis for 0635ee6. It will automatically update as commits are pushed.

@github-actions github-actions bot added the bug Something isn't working label Feb 16, 2025
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 0635ee6 in 42 seconds

More details
  • Looked at 38 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 drafted comments based on config settings.
1. pkg/types/alertmanagertypes/channel_test.go:183
  • Draft comment:
    Good change: using assert.JSONEq instead of assert.Equal to compare JSON ensures order-independent validation, reducing test flakiness.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    This comment is purely informative, explaining the benefits of using assert.JSONEq over assert.Equal. It doesn't provide a specific suggestion or ask for a change in the code.
2. pkg/types/alertmanagertypes/channel_test.go:187
  • Draft comment:
    Using assert.JSONEq here also improves reliability by ignoring JSON field order differences.
  • Reason this comment was not posted:
    Marked as duplicate.
3. go.mod:21
  • Draft comment:
    Promote github.com/go-openapi/strfmt as a direct dependency to ensure the correct version is used rather than relying on an indirect requirement.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    This comment is related to dependency management, which is not allowed according to the rules. It suggests promoting a dependency to a direct requirement, which falls under the category of dependency changes.
4. pkg/types/alertmanagertypes/channel_test.go:183
  • Draft comment:
    Use of assert.JSONEq improves robustness by comparing JSON content without being affected by key ordering.
  • Reason this comment was not posted:
    Marked as duplicate.
5. pkg/types/alertmanagertypes/channel_test.go:187
  • Draft comment:
    Using assert.JSONEq for receivers JSON comparison ensures tests are less flaky due to non-deterministic key ordering.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_PkYt2nLZKI7bivmu


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@grandwizard28 grandwizard28 merged commit a6cfb63 into main Feb 16, 2025
16 of 17 checks passed
@grandwizard28 grandwizard28 deleted the fix-alertmanager-tests branch February 16, 2025 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants