Skip to content

Commit 60ec2e6

Browse files
EvangelinkCopilot
andauthored
Allow slow Windows test probes to finish on loaded agents (#12565)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent f9a6e78 commit 60ec2e6

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/SystemWrappersTests.cs‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public sealed class SystemWrappersTests
2121
{
2222
private static readonly TimeSpan ChildLimit = TimeSpan.FromSeconds(30);
2323

24+
// A whole probe includes CLR startup, JIT, and application execution on a shared CI agent.
25+
private static readonly TimeSpan ChildExecutionLimit = TimeSpan.FromMinutes(2);
26+
2427
public TestContext TestContext { get; set; } = null!;
2528

2629
[TestMethod]
@@ -424,10 +427,10 @@ internal static async Task<ChildResult> RunChildAsync(string mode, string? modul
424427
Assert.IsTrue(process.Start());
425428
Task<string> output = process.StandardOutput.ReadToEndAsync();
426429
Task<string> error = process.StandardError.ReadToEndAsync();
427-
Task exit = process.WaitForExitAsync();
430+
var completion = Task.WhenAll(process.WaitForExitAsync(), output, error);
428431
try
429432
{
430-
await exit.TimeoutAfterAsync(ChildLimit);
433+
await completion.TimeoutAfterAsync(ChildExecutionLimit);
431434
return new(process.ExitCode, await output, await error);
432435
}
433436
finally
@@ -438,7 +441,7 @@ internal static async Task<ChildResult> RunChildAsync(string mode, string? modul
438441
}
439442

440443
// Join the original wait and readers even when the bounded observation timed out.
441-
await Task.WhenAll(exit, output, error).TimeoutAfterAsync(ChildLimit);
444+
await completion.TimeoutAfterAsync(ChildLimit);
442445
}
443446
}
444447

0 commit comments

Comments
 (0)