Skip to content

fix: Gitea test TestGiteaParamsChangedFilesCEL flakiness#2049

Merged
pipelines-as-code[bot] merged 1 commit intotektoncd:mainfrom
chmouel:fix-gitea-test-flakiness
Apr 16, 2025
Merged

fix: Gitea test TestGiteaParamsChangedFilesCEL flakiness#2049
pipelines-as-code[bot] merged 1 commit intotektoncd:mainfrom
chmouel:fix-gitea-test-flakiness

Conversation

@chmouel
Copy link
Copy Markdown
Member

@chmouel chmouel commented Apr 15, 2025

This PR refines the event reporting for PipelineRun cancellations to provide clearer messaging and prevent test failures from
expected cancellation events.

Changes:

  • Updated the event reason from RepositoryPipelineRun to CancelInProgress for cancellation-related messages, making the
    intent more explicit.
  • Modified end-to-end tests to ignore events with the CancelInProgress reason, preventing false negatives in test assertions.
  • Added a helper function (checkEvents) to filter out cancellation-related events during test validation.

Impact:

  • Better observability for cancellation actions in logs/events.
  • More reliable test execution by excluding expected cancellation events from failure checks.

Testing:

  • Existing end-to-end tests were updated to accommodate the changes.
  • Manual verification confirmed cancellation events are now properly labeled and filtered in test results.

Related Issues:
(N/A – or reference relevant issues if applicable)

Copilot AI review requested due to automatic review settings April 15, 2025 14:40
Copy link
Copy Markdown
Contributor

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

A work-in-progress pull request aiming to fix flakiness in the TestGiteaParamsChangedFilesCEL test by adjusting event expectations and iteration logic.

  • Introduces a new parameter "ExpectEventsNumber" to determine the expected count of events.
  • Updates iteration constructs in TestPR and NewPR functions for looping over a fixed number of iterations.
  • Enhances event logging and failure conditions based on the updated event expectations.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
test/pkg/gitea/test.go Added "ExpectEventsNumber" field, modified loop constructions for pull request creation and event handling.
test/gitea_params_test.go Updated test configuration to include "ExpectEventsNumber" with a value of 1.
Comments suppressed due to low confidence (3)

test/pkg/gitea/test.go:375

  • [nitpick] The variable name 'event' is used as an index when iterating over events.Items; consider renaming it to 'i' or 'idx' or using a two-value range loop for clarity.
for event := range events.Items {

test/pkg/gitea/test.go:206

  • The loop 'for i := range 5' is not valid Go syntax for iterating a fixed number of times. Consider reverting to 'for i := 0; i < 5; i++' or using a slice with a range.
for i := range 5 {

test/pkg/gitea/test.go:360

  • The change to 'for range 30' does not correctly iterate 30 times in Go. Use a traditional loop such as 'for i := 0; i < 30; i++' to achieve the intended iteration.
for range 30 {

@chmouel chmouel force-pushed the fix-gitea-test-flakiness branch 7 times, most recently from 12f46f1 to 5740efc Compare April 16, 2025 07:38
• Changed event reason from RepositoryPipelineRun to CancelInProgress
for pipeline run cancellation messages.
• Updated end-to-end tests to ignore events with the CancelInProgress reason.
• This provided clearer event reporting specific to cancellation actions.
• This prevented tests from spuriously failing due to expected
cancellation events

Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
@chmouel chmouel force-pushed the fix-gitea-test-flakiness branch from 5740efc to 977ac26 Compare April 16, 2025 07:44
@chmouel chmouel changed the title WIP fix: Gitea test TestGiteaParamsChangedFilesCEL flakiness fix: Gitea test TestGiteaParamsChangedFilesCEL flakiness Apr 16, 2025
@zakisk
Copy link
Copy Markdown
Member

zakisk commented Apr 16, 2025

/lgtm

Copy link
Copy Markdown

@pipelines-as-code pipelines-as-code bot left a comment

Choose a reason for hiding this comment

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

Congrats @chmouel your PR Has been approved 🎉

✅ Pull Request Approved

Approval Status:

  • Required Approvals: 1
  • Current Approvals: 1

👥 Reviewers Who Approved:

Reviewer Permission Level Approval Status
@zakisk admin

📝 Next Steps

  • Ensure all required checks pass
  • Comply with branch protection rules
  • Request a maintainer to merge using the /merge command (or merge it
    directly if you have repository permission).

Automated by the PAC Boussole 🧭

@chmouel
Copy link
Copy Markdown
Member Author

chmouel commented Apr 16, 2025

/merge

@pipelines-as-code pipelines-as-code bot merged commit c2b17f0 into tektoncd:main Apr 16, 2025
6 checks passed
@pipelines-as-code
Copy link
Copy Markdown

✅ PR Successfully Merged

  • Merge method: rebase
  • Merged by: @chmouel
  • Total approvals: 1/1

Approvals Summary:

Reviewer Permission Status
@zakisk admin

Thank you @chmouel for your valuable contribution! 🎉

Automated by the PAC Boussole 🧭

@chmouel chmouel deleted the fix-gitea-test-flakiness branch April 16, 2025 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants