Skip to content

Commit 2a46fe9

Browse files
Add start timeout and log messages. [LANGPLAT-816]
1 parent 4cf4182 commit 2a46fe9

File tree

1 file changed

+11
-0
lines changed
  • tracer/test/test-applications/regression/AspNetCoreSmokeTest

1 file changed

+11
-0
lines changed

tracer/test/test-applications/regression/AspNetCoreSmokeTest/Worker.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,19 @@ public Worker(ILogger<Worker> logger, IApplicationLifetime lifetime, IServicePro
3434

3535
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
3636
{
37+
var timeout = TimeSpan.FromMinutes(2);
38+
var startTime = DateTimeOffset.UtcNow;
39+
3740
while (!_appListening && !stoppingToken.IsCancellationRequested)
3841
{
42+
if (DateTimeOffset.UtcNow - startTime > timeout)
43+
{
44+
_logger.LogError("Timed out waiting for application to start after {Timeout}", timeout);
45+
Program.ExitCode = 1;
46+
_lifetime.StopApplication();
47+
return;
48+
}
49+
3950
_logger.LogInformation("Waiting for app started handling requests");
4051
await Task.Delay(100, stoppingToken);
4152
}

0 commit comments

Comments
 (0)