Skip to content

Commit a8b9ead

Browse files
author
David García Vives
committed
Included delay before cancelling task
1 parent 81d92c6 commit a8b9ead

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/Docker.DotNet.Tests/ISystemOperations.Tests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ public async Task MonitorEventsAsync_Succeeds()
9696

9797
var progressMessage = new Progress<Message>((m) =>
9898
{
99+
_output.WriteLine($"MonitorEventsAsync_Succeeds: Message - {m.Action} - {m.Status} {m.From} - {m.Type}");
99100
wasProgressCalled = true;
100101
Assert.NotNull(m);
101-
_output.WriteLine($"MonitorEventsAsync_Succeeds: Message - {m.Action} - {m.Status} {m.From} - {m.Type}");
102102
});
103103

104104
using var cts = CancellationTokenSource.CreateLinkedTokenSource(_cts.Token);
@@ -120,6 +120,9 @@ await _client.Images.DeleteImageAsync(
120120
},
121121
_cts.Token);
122122

123+
// Give it some time for output operation to complete before cancelling task
124+
await Task.Delay(TimeSpan.FromSeconds(1));
125+
123126
cts.Cancel();
124127

125128
await Assert.ThrowsAsync<TaskCanceledException>(() => task).ConfigureAwait(false);

0 commit comments

Comments
 (0)