Make the rebase E2E tests more resilient#5466
Merged
premun merged 3 commits intodotnet:mainfrom Nov 11, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR improves the resilience of E2E rebase tests by introducing a retry mechanism for validating file content in pull requests. Instead of assuming files are immediately available after waiting for a PR update, the new approach retries the verification to handle timing issues where content might not be immediately synchronized.
- Introduces a new helper method
WaitForFileContentInPullRequestthat retries file content validation - Refactors two test scenarios to use the new helper instead of direct file reads
- Removes direct file content assertions in favor of the retry-based approach
Comments suppressed due to low confidence (3)
test/ProductConstructionService.ScenarioTests/ScenarioTests/ScenarioTests_CodeFlowRebase.cs:434
- The retry loop calls
WaitForUpdatedPullRequestAsyncandCheckoutRemoteRefAsyncon every iteration, which are expensive operations. These should only be called once before the loop or include a delay between retries. Consider addingawait Task.Delay(WAIT_DELAY)after the content check fails to avoid hammering the system with rapid retries.
test/ProductConstructionService.ScenarioTests/ScenarioTests/ScenarioTests_CodeFlowRebase.cs:436 - The error message should include the actual content found and the expected content to aid debugging. Consider changing to:
throw new ScenarioTestException($\"File {filePath} in branch {targetBranch} did not have expected content after {maxAttempts} attempts. Expected: '{expectedContent}', but final content did not match.\");
test/ProductConstructionService.ScenarioTests/ScenarioTests/ScenarioTests_CodeFlowRebase.cs:425 - The loop variable
attemptis unused within the loop body. Consider replacing withfor (int i = 0; i < maxAttempts; i++)or using a while loop with a counter that's referenced in the error message to show how many attempts were made.
…enarioTests_CodeFlowRebase.cs Co-authored-by: Copilot <[email protected]>
pavel-purma
approved these changes
Nov 11, 2025
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.
#5362