Skip to content
Closed
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
8 changes: 4 additions & 4 deletions tests/Atomizer.Tests/Processing/QueuePumpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ public async Task StopAsync_WhenWorkerIsLongRunning_ShouldRespectGracePeriod()
await pump.StopAsync(TimeSpan.FromSeconds(1), CancellationToken.None);
sw.Stop();

// Assert: Should return after about 1 second, not 2
// Assert: Should return after the grace period (1s), well before the worker finishes (3s)
sw.Elapsed.TotalSeconds.Should().BeGreaterThanOrEqualTo(1);
sw.Elapsed.TotalSeconds.Should()
.BeLessThanOrEqualTo(
1.5,
$"StopAsync should return after about 1 second, elapsed: {sw.Elapsed.TotalSeconds}"
.BeLessThan(
2.5,
$"StopAsync should return after the grace period, not wait for the worker, elapsed: {sw.Elapsed.TotalSeconds}"
);

logger.Received(1).LogInformation($"Stopping queue '{queueOptions.QueueKey}'...");
Expand Down
Loading