Skip to content

bug: fix a flakey test #23

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

Merged
merged 2 commits into from
Apr 15, 2025
Merged

bug: fix a flakey test #23

merged 2 commits into from
Apr 15, 2025

Conversation

GrantBirki
Copy link
Member

resolves: #22

@GrantBirki GrantBirki added the bug Something isn't working label Apr 15, 2025
@GrantBirki GrantBirki self-assigned this Apr 15, 2025
@Copilot Copilot AI review requested due to automatic review settings April 15, 2025 06:00
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses a flakey test issue by removing t.Parallel() from the function level in TestBranchMatchesCriteria and moving it to the subtests, along with making local copies of the test variables and preserving global state with a deferred restoration.

  • Removed t.Parallel() from the function scope to avoid global variable races.
  • Introduced a local copy of the test variable in the loop.
  • Added logic to save and restore global variables during each subtest.
Comments suppressed due to low confidence (1)

internal/cmd/match_criteria_test.go:266

  • [nitpick] Consider renaming the local variable (e.g., to 'testCase') for improved clarity and to better differentiate it from the loop variable.
test := test // Create a local copy of the test variable to use in the closure

@GrantBirki GrantBirki merged commit 5efdd32 into main Apr 15, 2025
7 checks passed
@GrantBirki GrantBirki deleted the flakey-test branch April 15, 2025 06:03
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.

fix a flakey test
1 participant