Simplify retry extension logic to use built-in filters#7511
Simplify retry extension logic to use built-in filters#7511Evangelink wants to merge 4 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR simplifies the Retry extension by removing the custom test execution filter factory and instead relying on the platform’s built-in --filter-uid functionality when re-running failed tests.
Changes:
- Update
RetryOrchestratorto remove any existing test filter options and apply--filter-uidwith the failed test UIDs on retry. - Remove the Retry extension’s custom
ITestExecutionFilterFactoryintegration (and the defaultTestHostManagerrequirement). - Add/adjust acceptance coverage to validate retry behavior when an initial filter is present.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/RetryFailedTestsTests.cs | Adds new acceptance scenarios for retry behavior with pre-existing filters and updates the embedded test asset to respect UID filtering. |
| src/Platform/Microsoft.Testing.Extensions.Retry/RetryOrchestrator.cs | Replaces the previous in-process filter approach by rewriting command line filters on retry and introduces helper logic to remove existing options. |
| src/Platform/Microsoft.Testing.Extensions.Retry/RetryExtensions.cs | Removes registration of the custom retry execution filter factory and the dependency on the default TestHostManager. |
| src/Platform/Microsoft.Testing.Extensions.Retry/RetryExecutionFilterFactory.cs | Deletes the custom filter factory implementation (no longer needed with built-in filtering). |
src/Platform/Microsoft.Testing.Extensions.Retry/RetryOrchestrator.cs
Outdated
Show resolved
Hide resolved
...grationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/RetryFailedTestsTests.cs
Outdated
Show resolved
Hide resolved
src/Platform/Microsoft.Testing.Extensions.Retry/RetryOrchestrator.cs
Outdated
Show resolved
Hide resolved
...grationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/RetryFailedTestsTests.cs
Outdated
Show resolved
Hide resolved
src/Platform/Microsoft.Testing.Extensions.Retry/RetryOrchestrator.cs
Outdated
Show resolved
Hide resolved
| await writer.WriteAsync($"--{PlatformCommandLineProvider.FilterUidOptionKey}").ConfigureAwait(false); | ||
| foreach (string uid in lastListOfFailedId) | ||
| { | ||
| await writer.WriteAsync($" \"{uid}\"").ConfigureAwait(false); |
There was a problem hiding this comment.
I think we need to verify what are the escaping rules from our rsp parsing implementation and if we need to escape some stuff if the uid contains them
| string resultDir = Environment.GetEnvironmentVariable("RESULTDIR")!; | ||
| bool crash = Environment.GetEnvironmentVariable("CRASH") == "1"; | ||
|
|
||
| var uidFilter = (context.Request as TestExecutionRequest)?.Filter as TestNodeUidListFilter; |
There was a problem hiding this comment.
I'm wondering how did this test work before? How was it respecting the retry filter?
| } | ||
| } | ||
|
|
||
| finalArguments.Add($"@{responseFilePath}"); |
There was a problem hiding this comment.
If this path has a space, we might fail.
We need proper escaping.
There was a problem hiding this comment.
Hmm, actually not, that's handled. finalArguments is the unescaped arguments which will either be handled by runtime or by PasteArguments.
It might still be worth to add a test
Fixes #7500