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
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,22 @@ async Task InitializeServiceControlCore(ScenarioContext context)

public override async Task Stop(CancellationToken cancellationToken = default)
{
// The scenario passes the test's own token here, which has already fired when the test timed out.
// Stopping with it aborts the host mid-shutdown, and the exception that produces replaces the
// timeout as the reported failure. Shutdown gets its own budget instead.
using var shutdown = new CancellationTokenSource(ShutdownTimeout);

using (new DiagnosticTimer($"Test TearDown for {instanceName}"))
{
await host.StopAsync(cancellationToken);
await host.StopAsync(shutdown.Token);
HttpClient.Dispose();
await host.DisposeAsync();
await persistenceToUse.Cleanup(cancellationToken);
await persistenceToUse.Cleanup(shutdown.Token);
}
}

static readonly TimeSpan ShutdownTimeout = TimeSpan.FromSeconds(30);

WebApplication host;
readonly ITransportIntegration transportToUse;
readonly IAcceptanceTestStorageConfiguration persistenceToUse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,21 @@ async Task InitializeServiceControlCore(ScenarioContext context)

public override async Task Stop(CancellationToken cancellationToken = default)
{
// The scenario passes the test's own token here, which has already fired when the test timed out.
// Stopping with it aborts the host mid-shutdown, and the exception that produces replaces the
// timeout as the reported failure. Shutdown gets its own budget instead.
using var shutdown = new CancellationTokenSource(ShutdownTimeout);

using (new DiagnosticTimer($"Test TearDown for {instanceName}"))
{
await host.StopAsync(cancellationToken);
await host.StopAsync(shutdown.Token);
HttpClient.Dispose();
await host.DisposeAsync();
}
}

static readonly TimeSpan ShutdownTimeout = TimeSpan.FromSeconds(30);

string instanceName = Settings.DEFAULT_INSTANCE_NAME;
WebApplication host;
Settings settings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,21 @@ async Task InitializeServiceControl(ScenarioContext context, CancellationToken c

public override async Task Stop(CancellationToken cancellationToken = default)
{
// The scenario passes the test's own token here, which has already fired when the test timed out.
// Stopping with it aborts the host mid-shutdown, and the exception that produces replaces the
// timeout as the reported failure. Shutdown gets its own budget instead.
using var shutdown = new CancellationTokenSource(ShutdownTimeout);

using (new DiagnosticTimer($"Test TearDown for {settings.InstanceName}"))
{
await host.StopAsync(cancellationToken);
await host.StopAsync(shutdown.Token);
HttpClient.Dispose();
await host.DisposeAsync();
}
}

static readonly TimeSpan ShutdownTimeout = TimeSpan.FromSeconds(30);

WebApplication host;
Settings settings;
}
Expand Down