1+ using Microsoft . Extensions . Configuration ;
12using Microsoft . Extensions . Logging ;
23using System . Runtime . CompilerServices ;
4+ using System . Threading ;
35using Xunit . Abstractions ;
46
57namespace OutputWatcherTestProject . Tests ;
68
79public class OutputWatcherIntegrationTests ( ITestOutputHelper outputHelper )
810{
911 private void WriteFunctionName ( [ CallerMemberName ] string ? caller = null ) => outputHelper . WriteLine ( caller ) ;
12+ private const int WaitForHealthyTimeoutSeconds = 90 ;
1013 private static readonly TimeSpan WaitForHealthyTimeout = TimeSpan . FromSeconds ( 90 ) ;
1114
1215 private async Task < IDistributedApplicationTestingBuilder > CreateAppHostAsync ( )
@@ -18,6 +21,7 @@ private async Task<IDistributedApplicationTestingBuilder> CreateAppHostAsync()
1821 var appHost = await DistributedApplicationTestingBuilder . CreateAsync < Projects . AspireAppHostWaitForConsole > ( [ ] , ( dab , host ) =>
1922 {
2023 dab . EnableResourceLogging = true ;
24+ host . Configuration ! . AddUserSecrets < OutputWatcherIntegrationTests > ( ) ;
2125 } ) ;
2226 appHost
2327 . Services
@@ -30,12 +34,12 @@ private async Task<IDistributedApplicationTestingBuilder> CreateAppHostAsync()
3034
3135 appHost . Services . ConfigureHttpClientDefaults ( clientBuilder =>
3236 {
33-
37+ var timeout = TimeSpan . FromSeconds ( appHost . Configuration . GetValue < double > ( "HttpClientTimeout" , 30 ) ) ;
3438 clientBuilder
3539 . AddStandardResilienceHandler ( res => {
36- res . TotalRequestTimeout . Timeout = TimeSpan . FromSeconds ( 120 ) ;
37- res . CircuitBreaker . SamplingDuration = TimeSpan . FromSeconds ( 60 ) ;
38- res . AttemptTimeout . Timeout = TimeSpan . FromSeconds ( 30 ) ;
40+ res . TotalRequestTimeout . Timeout = timeout * 4 ;
41+ res . CircuitBreaker . SamplingDuration = timeout * 2 ;
42+ res . AttemptTimeout . Timeout = timeout ;
3943 } ) ;
4044 clientBuilder
4145 . ConfigurePrimaryHttpMessageHandler ( ( ) =>
0 commit comments