Skip to content

fix: TestGHEPullRequestGitopsCommentCancel race#2598

Open
chmouel wants to merge 1 commit intotektoncd:mainfrom
chmouel:fix-e2e-
Open

fix: TestGHEPullRequestGitopsCommentCancel race#2598
chmouel wants to merge 1 commit intotektoncd:mainfrom
chmouel:fix-e2e-

Conversation

@chmouel
Copy link
Member

@chmouel chmouel commented Mar 20, 2026

📝 Description of the Change

The E2E test TestGithubGHEPullRequestGitopsCommentCancel in test/github_pullrequest_retest_test.go fails intermittently because it uses the wrong wait strategy after issuing /cancel. The test uses UntilRepositoryUpdated with MinNumberStatus: 3, which passes immediately when there are already ≥3 repo statuses — before the cancel has taken effect. The last status is then ConditionTrue (succeeded) instead of the expected ConditionFalse (cancelled).

Reuse the same robust pattern that we already do in test/github_push_retest_test.go:194-211, it does this:

  1. Waits for the PipelineRun to have Cancelled reason via UntilPipelineRunHasReason
  2. Then waits for the Repository status to have Cancelled reason via UntilRepositoryHasStatusReason
  3. Falls back to checking controller logs if the cancel didn't propagate

🔗 Linked GitHub Issue

Fixes #2599

🧪 Testing Strategy

  • Unit tests
  • Integration tests
  • End-to-end tests
  • Manual testing
  • Not Applicable

🤖 AI Assistance

AI assistance can be used for various tasks, such as code generation, documentation, or testing.

Please indicate whether you have used AI assistance for this PR and provide details if applicable.

  • I have not used any AI assistance for this PR.
  • I have used AI assistance for this PR.

Important

Slop will be simply rejected, if you are using AI assistance you need to make sure you understand the code generated and that it meets the project's standards. you need at least know how to run the code and deploy it (if needed). See startpaac to make it easy to deploy and test your code changes.

If the majority of the code in this PR was generated by an AI, please add a Co-authored-by trailer to your commit message.
For example:

Co-authored-by: Claude noreply@anthropic.com

✅ Submitter Checklist

  • 📝 My commit messages are clear, informative, and follow the project's How to write a git commit message guide. The Gitlint linter ensures in CI it's properly validated
  • ✨ I have ensured my commit message prefix (e.g., fix:, feat:) matches the "Type of Change" I selected above.
  • ♽ I have run make test and make lint locally to check for and fix any issues. For an efficient workflow, I have considered installing pre-commit and running pre-commit install to automate these checks.
  • 📖 I have added or updated documentation for any user-facing changes.
  • 🧪 I have added sufficient unit tests for my code changes.
  • 🎁 I have added end-to-end tests where feasible. See README for more details.
  • 🔎 I have addressed any CI test flakiness.

The E2E test TestGithubGHEPullRequestGitopsCommentCancel in
test/github_pullrequest_retest_test.go:64 fails intermittently because
it uses the wrong wait strategy after issuing /cancel. The test uses
UntilRepositoryUpdated with MinNumberStatus: 3, which passes immediately
when there are already ≥3 repo statuses — before the cancel has taken
effect. The last status is then ConditionTrue (succeeded) instead of the
expected ConditionFalse (cancelled)

Reuse the same robust pattern that we already do in
test/github_push_retest_test.go:194-211, it does this:

1. Waits for the PipelineRun to have Cancelled reason via
   UntilPipelineRunHasReason
2. Then waits for the Repository status to have Cancelled reason via
   UntilRepositoryHasStatusReason
3. Falls back to checking controller logs if the cancel didn't propagate
@chmouel chmouel self-assigned this Mar 20, 2026
@chmouel chmouel marked this pull request as ready for review March 20, 2026 08:47
@chmouel
Copy link
Member Author

chmouel commented Mar 20, 2026

/test linters

@chmouel
Copy link
Member Author

chmouel commented Mar 20, 2026

/test go-testing

@chmouel
Copy link
Member Author

chmouel commented Mar 20, 2026

/test all

@chmouel
Copy link
Member Author

chmouel commented Mar 20, 2026

/retest all

@chmouel
Copy link
Member Author

chmouel commented Mar 20, 2026

/test linters

2 similar comments
@chmouel
Copy link
Member Author

chmouel commented Mar 20, 2026

/test linters

@chmouel
Copy link
Member Author

chmouel commented Mar 20, 2026

/test linters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TestGHEPullRequestGitopsCommentCancel test is flaky due to incorrect wait strategy

1 participant