Centralize test timeout constants to fix CI flakiness (#1224)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ericstj <8918108+ericstj@users.noreply.github.com> Co-authored-by: Eric StJohn <ericstj@microsoft.com>
This commit is contained in:
parent
283caf9810
commit
a83d6198a5
1 changed files with 43 additions and 6 deletions
|
|
@ -33,6 +33,7 @@ public sealed class Program
|
|||
|
||||
private readonly ILoggerProvider? _loggerProvider;
|
||||
private readonly IConnectionListenerFactory? _kestrelTransport;
|
||||
private readonly TaskCompletionSource _serverStarted = new(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Program"/> class with logging and transport parameters.
|
||||
|
|
@ -47,6 +48,11 @@ public sealed class Program
|
|||
_kestrelTransport = kestrelTransport;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a task that completes when the server has started and is ready to accept connections.
|
||||
/// </summary>
|
||||
public Task ServerStarted => _serverStarted.Task;
|
||||
|
||||
// Track if we've already issued an already-expired token for the CanAuthenticate_WithTokenRefresh test which uses the test-refresh-client registration.
|
||||
public bool HasRefreshedToken { get; set; }
|
||||
|
||||
|
|
@ -541,7 +547,20 @@ public sealed class Program
|
|||
Console.WriteLine($"Demo Client ID: {clientId}");
|
||||
Console.WriteLine($"Demo Client Secret: {clientSecret}");
|
||||
|
||||
await app.RunAsync(cancellationToken);
|
||||
await app.StartAsync(cancellationToken);
|
||||
_serverStarted.TrySetResult();
|
||||
|
||||
// Wait until cancellation is requested
|
||||
try
|
||||
{
|
||||
await Task.Delay(Timeout.Infinite, cancellationToken);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// Expected when cancellation is requested
|
||||
}
|
||||
|
||||
await app.StopAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Reference in a new issue