Skip to content

Commit

Permalink
Simplify test.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmds committed Jun 10, 2023
1 parent d2115a7 commit 706acd6
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions Turkey.Tests/ProcessExtensionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,10 @@ public async Task WaitForExitAsync_DoesNotHangForOrphanedGrandChildren()
using Process process = Process.Start(psi);

// Use a shorter timeout for WaitForExitAsync than the grandchild lives.
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(WaitTimeoutSeconds));

// The WaitForExit completes by cancellation.
await Assert.ThrowsAsync<TaskCanceledException>(() => process.WaitForExitAsync(cts.Token, new StringWriter(), new StringWriter()));

// The completion takes at least the WaitTime.
stopWatch.Stop();
TimeSpan elapsedTime = stopWatch.Elapsed;
Assert.True(elapsedTime >= TimeSpan.FromSeconds(WaitTimeoutSeconds), "The grandchild is not keeping the script alive");
}
finally
{
Expand Down

0 comments on commit 706acd6

Please sign in to comment.