Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions src/Aspire.Hosting.Testing/DistributedApplicationFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,9 @@ public async Task StartAsync(CancellationToken cancellationToken = default)

public async Task StopAsync(CancellationToken cancellationToken = default)
{
using var linkedToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, appFactory._disposingCts.Token);
await innerHost.StopAsync(linkedToken.Token).ConfigureAwait(false);
// The cancellation token is passed as-is here to give the host a chance to stop gracefully.
// Internally, in the host itself, the value of HostOptions.ShutdownTimeout limits how long the host has to stop gracefully.
await innerHost.StopAsync(cancellationToken).ConfigureAwait(false);
}
}
}
3 changes: 0 additions & 3 deletions tests/Aspire.Hosting.Testing.Tests/TestingBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,6 @@ public async Task CrashTests(bool genericEntryPoint, string crashArg)
{
var exception = await Assert.ThrowsAsync<InvalidOperationException>(() => app.StartAsync().WaitAsync(cts.Token));
Assert.Contains(crashArg, exception.Message);

await app.DisposeAsync().AsTask().WaitAsync(cts.Token);
return;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ public async Task CrashTests(string crashArg)
{
var exception = await Assert.ThrowsAsync<InvalidOperationException>(() => factory.StartAsync().WaitAsync(cts.Token));
Assert.Contains(crashArg, exception.Message);
await factory.DisposeAsync().AsTask().WaitAsync(cts.Token);
return;
}
else
{
Expand Down