diff --git a/src/Utilities.UnitTests/ToolTask_Tests.cs b/src/Utilities.UnitTests/ToolTask_Tests.cs index 06811207770..76d4dd912fb 100644 --- a/src/Utilities.UnitTests/ToolTask_Tests.cs +++ b/src/Utilities.UnitTests/ToolTask_Tests.cs @@ -846,10 +846,12 @@ public void ToolTaskThatTimeoutAndRetry(int repeats, int initialDelay, int follo { using var env = TestEnvironment.Create(_output); + MockEngine engine = new(); + // Task under test: var task = new ToolTaskThatSleeps { - BuildEngine = new MockEngine(), + BuildEngine = engine, InitialDelay = initialDelay, FollowupDelay = followupDelay, Timeout = timeout @@ -861,6 +863,9 @@ public void ToolTaskThatTimeoutAndRetry(int repeats, int initialDelay, int follo { // Execute the task: result = task.Execute(); + + _output.WriteLine(engine.Log); + task.RepeatCount.ShouldBe(i); // The first execution may fail (timeout), but all following ones should succeed: @@ -882,7 +887,7 @@ public void ToolTaskThatTimeoutAndRetry(int repeats, int initialDelay, int follo private sealed class ToolTaskThatSleeps : ToolTask { // PowerShell command to sleep: - private readonly string _powerShellSleep = "-ExecutionPolicy RemoteSigned -Command \"Start-Sleep -Milliseconds {0}\""; + private readonly string _powerShellSleep = "-NoProfile -ExecutionPolicy RemoteSigned -Command \"Start-Sleep -Milliseconds {0}\""; // UNIX command to sleep: private readonly string _unixSleep = "-c \"sleep {0}\"";