Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/Utilities.UnitTests/ToolTask_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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}\"";
Expand Down