test(functional): replace merge-status sleeps with polling helper - #3427
Draft
JohnVillalovos wants to merge 1 commit into
Draft
test(functional): replace merge-status sleeps with polling helper#3427JohnVillalovos wants to merge 1 commit into
JohnVillalovos wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reduces functional test flakiness by replacing fixed sleeps with a reusable polling helper that waits for GitLab state transitions (mergeability evaluation and merge completion) before proceeding.
Changes:
- Add
helpers.poll_until()as a generic “wait until condition or fail” utility using a monotonic timeout. - Replace a blind
time.sleep(30)in the CLI functional test with polling ondetailed_merge_status. - Replace duplicated “poll until
merged_atis set” loops in merge request API functional tests and the MR fixture with the shared helper.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
tests/functional/helpers.py |
Adds a generic polling helper to replace fixed sleeps and duplicated polling loops. |
tests/functional/conftest.py |
Uses polling in the MR fixture to wait for detailed_merge_status to settle. |
tests/functional/cli/test_cli_v4.py |
Replaces a fixed 30s sleep with polling for mergeability evaluation completion. |
tests/functional/api/test_merge_requests.py |
Replaces duplicated merge-completion polling loops with the shared helper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
JohnVillalovos
force-pushed
the
jlvillal/test_accept_request_merge_flaky
branch
from
July 27, 2026 03:30
ef88f48 to
4e75be3
Compare
JohnVillalovos
marked this pull request as draft
July 27, 2026 05:32
JohnVillalovos
force-pushed
the
jlvillal/test_accept_request_merge_flaky
branch
7 times, most recently
from
July 28, 2026 04:08
be0995b to
19393df
Compare
Trying to make the tests less flaky. Have seen some issues with tests needing to be manually re-run due to failures. `test_accept_request_merge` used a blind `time.sleep(30)` before attempting to merge, which was flaky whenever GitLab hadn't finished evaluating mergeability by the time the sleep ended, causing intermittent CI failures with `GitlabMRClosedError: Branch cannot be merged`. Add `helpers.poll_until()`, a generic poll-until-condition-or-fail helper, and use it to replace the blind sleep with a check on `detailed_merge_status`, plus the duplicated `merged_at` polling loops in `test_merge_requests.py` and the `_make_merge_request` fixture in conftest.py. Assisted-by: Claude Sonnet 5
JohnVillalovos
force-pushed
the
jlvillal/test_accept_request_merge_flaky
branch
from
July 30, 2026 05:11
19393df to
0bcfec0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Trying to make the tests less flaky. Have seen some issues with tests needing to be manually re-run due to failures.
test_accept_request_mergeused a blindtime.sleep(30)before attempting to merge, which was flaky whenever GitLab hadn't finished evaluating mergeability by the time the sleep ended, causing intermittent CI failures withGitlabMRClosedError: Branch cannot be merged.Add
helpers.poll_until(), a generic poll-until-condition-or-fail helper, and use it to replace the blind sleep with a check ondetailed_merge_status, plus the duplicatedmerged_atpolling loops intest_merge_requests.pyand the_make_merge_requestfixture in conftest.py.Assisted-by: Claude Sonnet 5