Skip to content

Add --retry-failed-tests-delay option to MTP retry package#7840

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-retry-delay-seconds-option
Draft

Add --retry-failed-tests-delay option to MTP retry package#7840
Copilot wants to merge 2 commits intomainfrom
copilot/add-retry-delay-seconds-option

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 25, 2026

The retry extension had no way to introduce a wait between retry attempts, making it less useful for tests interacting with external systems (message queues, databases, etc.) where a cooldown period reduces flakiness.

Changes

  • New CLI option --retry-failed-tests-delay: accepts a timespan value using the same unit-aware format as --hangdump-timeout (e.g. 200, 1s, 2.5m, 1h; default unit is milliseconds)
  • RetryCommandLineOptionsProvider: registers the option, validates it requires --retry-failed-tests, and validates the argument via TimeSpanParser.TryParse
  • RetryOrchestrator: strips the delay arg from arguments forwarded to child processes; applies Task.Delay between attempts (not after the final attempt)
  • Resources: added description and invalid-argument error strings
  • Tests: coverage for valid/invalid timespan values and the dependency-on-retry-option validation

Usage

dotnet test -- --retry-failed-tests 3 --retry-failed-tests-delay 2s

Copilot AI requested review from Copilot and removed request for Copilot April 25, 2026 20:56
Copilot AI changed the title [WIP] Add --retry-delay-seconds option for MTP retry Add --retry-failed-tests-delay option to MTP retry package Apr 25, 2026
Copilot AI requested a review from Evangelink April 25, 2026 20:56
{
TimeSpan delay = TimeSpanParser.Parse(retryDelay[0]);
await logger.LogDebugAsync($"Waiting {delay} before next retry attempt").ConfigureAwait(false);
await Task.Delay(delay, cancellationToken).ConfigureAwait(false);
Copy link
Copy Markdown
Member

@Youssef1313 Youssef1313 Apr 26, 2026

Choose a reason for hiding this comment

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

Is this:

  • adding the delay even when we are on the last attempt?
  • Also delaying moving test results to the correct attempt results directory?

I think it's more clear to add the delay just before Process.Start exactly, with a condition that it's not the first attempt.

Overall, I don't think a single request for the feature is worth adding it, but up to you if you think it's useful enough to add it.

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.

MTP retry: add a --retry-delay-seconds option to add delay in seconds between retries

3 participants