77using Aspire . Hosting . Dcp ;
88using Aspire . Hosting . Tests . Utils ;
99using Aspire . Hosting . Utils ;
10+ using Microsoft . AspNetCore . InternalTesting ;
1011using Microsoft . Extensions . Configuration ;
1112using Microsoft . Extensions . DependencyInjection ;
1213using Microsoft . Extensions . Logging ;
@@ -40,7 +41,7 @@ public async Task DashboardIsAutomaticallyAddedAsHiddenResource()
4041
4142 using var app = builder . Build ( ) ;
4243
43- await app . ExecuteBeforeStartHooksAsync ( default ) ;
44+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
4445
4546 var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
4647
@@ -64,7 +65,7 @@ public async Task DashboardIsAddedFirst()
6465
6566 using var app = builder . Build ( ) ;
6667
67- await app . ExecuteBeforeStartHooksAsync ( default ) ;
68+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
6869
6970 var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
7071
@@ -95,15 +96,15 @@ public async Task DashboardDoesNotAddResource_ConfiguresExistingDashboard()
9596
9697 using var app = builder . Build ( ) ;
9798
98- await app . ExecuteBeforeStartHooksAsync ( default ) ;
99+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
99100
100101 var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
101102
102103 var dashboard = Assert . Single ( model . Resources ) ;
103104
104105 Assert . Same ( container . Resource , dashboard ) ;
105106
106- var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , TestServiceProvider . Instance ) ;
107+ var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , TestServiceProvider . Instance ) . DefaultTimeout ( ) ;
107108
108109 Assert . Collection ( config ,
109110 e =>
@@ -165,13 +166,13 @@ public async Task DashboardWithDllPathLaunchesDotnet()
165166
166167 var app = builder . Build ( ) ;
167168
168- await app . ExecuteBeforeStartHooksAsync ( default ) ;
169+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
169170
170171 var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
171172
172173 var dashboard = Assert . Single ( model . Resources . OfType < ExecutableResource > ( ) ) ;
173174
174- var args = await ArgumentEvaluator . GetArgumentListAsync ( dashboard ) ;
175+ var args = await ArgumentEvaluator . GetArgumentListAsync ( dashboard ) . DefaultTimeout ( ) ;
175176
176177 Assert . NotNull ( dashboard ) ;
177178 Assert . Equal ( "aspire-dashboard" , dashboard . Name ) ;
@@ -201,13 +202,13 @@ public async Task DashboardAuthConfigured_EnvVarsPresent()
201202
202203 using var app = builder . Build ( ) ;
203204
204- await app . ExecuteBeforeStartHooksAsync ( default ) ;
205+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
205206
206207 var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
207208
208209 var dashboard = Assert . Single ( model . Resources ) ;
209210
210- var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , TestServiceProvider . Instance ) ;
211+ var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , TestServiceProvider . Instance ) . DefaultTimeout ( ) ;
211212
212213 Assert . Equal ( "BrowserToken" , config . Single ( e => e . Key == DashboardConfigNames . DashboardFrontendAuthModeName . EnvVarName ) . Value ) ;
213214 Assert . Equal ( "TestBrowserToken!" , config . Single ( e => e . Key == DashboardConfigNames . DashboardFrontendBrowserTokenName . EnvVarName ) . Value ) ;
@@ -236,13 +237,13 @@ public async Task DashboardAuthRemoved_EnvVarsUnsecured()
236237
237238 using var app = builder . Build ( ) ;
238239
239- await app . ExecuteBeforeStartHooksAsync ( default ) ;
240+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
240241
241242 var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
242243
243244 var dashboard = Assert . Single ( model . Resources ) ;
244245
245- var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , TestServiceProvider . Instance ) ;
246+ var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , TestServiceProvider . Instance ) . DefaultTimeout ( ) ;
246247
247248 Assert . Equal ( "Unsecured" , config . Single ( e => e . Key == DashboardConfigNames . DashboardFrontendAuthModeName . EnvVarName ) . Value ) ;
248249 Assert . Equal ( "Unsecured" , config . Single ( e => e . Key == DashboardConfigNames . DashboardOtlpAuthModeName . EnvVarName ) . Value ) ;
@@ -268,13 +269,13 @@ public async Task DashboardResourceServiceUriIsSet()
268269
269270 using var app = builder . Build ( ) ;
270271
271- await app . ExecuteBeforeStartHooksAsync ( default ) ;
272+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
272273
273274 var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
274275
275276 var dashboard = Assert . Single ( model . Resources ) ;
276277
277- var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , TestServiceProvider . Instance ) ;
278+ var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , TestServiceProvider . Instance ) . DefaultTimeout ( ) ;
278279
279280 Assert . Equal ( "http://localhost:5000" , config . Single ( e => e . Key == DashboardConfigNames . ResourceServiceUrlName . EnvVarName ) . Value ) ;
280281 }
@@ -301,7 +302,7 @@ public async Task DashboardResource_OtlpHttpEndpoint_CorsEnvVarSet()
301302
302303 using var app = builder . Build ( ) ;
303304
304- await app . ExecuteBeforeStartHooksAsync ( default ) ;
305+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
305306
306307 var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
307308
@@ -312,7 +313,7 @@ public async Task DashboardResource_OtlpHttpEndpoint_CorsEnvVarSet()
312313
313314 var dashboard = Assert . Single ( model . Resources . Where ( r => r . Name == "aspire-dashboard" ) ) ;
314315
315- var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , app . Services ) ;
316+ var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , app . Services ) . DefaultTimeout ( ) ;
316317
317318 Assert . Equal ( "http://localhost:8081,http://localhost:58080" , config . Single ( e => e . Key == DashboardConfigNames . DashboardOtlpCorsAllowedOriginsKeyName . EnvVarName ) . Value ) ;
318319 Assert . Equal ( "*" , config . Single ( e => e . Key == DashboardConfigNames . DashboardOtlpCorsAllowedHeadersKeyName . EnvVarName ) . Value ) ;
@@ -340,13 +341,13 @@ public async Task DashboardResource_OtlpGrpcEndpoint_CorsEnvVarNotSet()
340341
341342 using var app = builder . Build ( ) ;
342343
343- await app . ExecuteBeforeStartHooksAsync ( default ) ;
344+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
344345
345346 var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
346347
347348 var dashboard = Assert . Single ( model . Resources . Where ( r => r . Name == "aspire-dashboard" ) ) ;
348349
349- var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , app . Services ) ;
350+ var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , app . Services ) . DefaultTimeout ( ) ;
350351
351352 Assert . DoesNotContain ( config , e => e . Key == DashboardConfigNames . DashboardOtlpCorsAllowedOriginsKeyName . EnvVarName ) ;
352353 Assert . DoesNotContain ( config , e => e . Key == DashboardConfigNames . DashboardOtlpCorsAllowedHeadersKeyName . EnvVarName ) ;
@@ -365,7 +366,7 @@ public async Task DashboardIsNotAddedInPublishMode()
365366
366367 using var app = builder . Build ( ) ;
367368
368- await app . ExecuteBeforeStartHooksAsync ( default ) ;
369+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
369370
370371 var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
371372
@@ -381,7 +382,7 @@ public async Task DashboardIsNotAddedIfDisabled()
381382
382383 var app = builder . Build ( ) ;
383384
384- await app . ExecuteBeforeStartHooksAsync ( default ) ;
385+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
385386
386387 var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
387388
@@ -446,7 +447,7 @@ public async Task DashboardLifecycleHookWatchesLogs(LogLevel logLevel)
446447 }
447448 } ) ;
448449
449- await app . ExecuteBeforeStartHooksAsync ( default ) . WaitAsync ( TimeSpan . FromSeconds ( 15 ) ) ;
450+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
450451
451452 var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
452453 var resourceNotificationService = app . Services . GetRequiredService < ResourceNotificationService > ( ) ;
@@ -457,10 +458,10 @@ public async Task DashboardLifecycleHookWatchesLogs(LogLevel logLevel)
457458 Assert . Equal ( "aspire-dashboard" , dashboard . Name ) ;
458459
459460 // Push a notification through to the dashboard resource.
460- await resourceNotificationService . PublishUpdateAsync ( dashboard , "aspire-dashboard-0" , s => s with { State = "Running" } ) ;
461+ await resourceNotificationService . PublishUpdateAsync ( dashboard , "aspire-dashboard-0" , s => s with { State = "Running" } ) . DefaultTimeout ( ) ;
461462
462463 // Wait for logs to be subscribed to
463- await watchForLogSubs . WaitAsync ( TimeSpan . FromSeconds ( 15 ) ) ;
464+ await watchForLogSubs . DefaultTimeout ( ) ;
464465
465466 // Push some logs through to the dashboard resource.
466467 var logger = resourceLoggerService . GetLogger ( "aspire-dashboard-0" ) ;
@@ -481,12 +482,12 @@ public async Task DashboardLifecycleHookWatchesLogs(LogLevel logLevel)
481482 Assert . NotNull ( testLogger ) ;
482483
483484 // Get the first log message that was logged
484- var log = await testLogger . FirstLogTask . WaitAsync ( TimeSpan . FromSeconds ( 15 ) ) ;
485+ var log = await testLogger . FirstLogTask . DefaultTimeout ( ) ;
485486
486487 Assert . Equal ( "Test dashboard message" , log . Message ) ;
487488 Assert . Equal ( logLevel , log . LogLevel ) ;
488489
489- await app . DisposeAsync ( ) . AsTask ( ) . WaitAsync ( TimeSpan . FromSeconds ( 15 ) ) ;
490+ await app . DisposeAsync ( ) . AsTask ( ) . DefaultTimeout ( ) ;
490491 }
491492
492493 [ Fact ]
@@ -498,7 +499,7 @@ public async Task DashboardIsExcludedFromManifestInPublishModeEvenIfAddedExplici
498499
499500 var app = builder . Build ( ) ;
500501
501- await app . ExecuteBeforeStartHooksAsync ( default ) ;
502+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
502503
503504 var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
504505
@@ -507,7 +508,7 @@ public async Task DashboardIsExcludedFromManifestInPublishModeEvenIfAddedExplici
507508 Assert . NotNull ( dashboard ) ;
508509 var annotation = Assert . Single ( dashboard . Annotations . OfType < ManifestPublishingCallbackAnnotation > ( ) ) ;
509510
510- var manifest = await ManifestUtils . GetManifestOrNull ( dashboard ) ;
511+ var manifest = await ManifestUtils . GetManifestOrNull ( dashboard ) . DefaultTimeout ( ) ;
511512
512513 Assert . Equal ( "aspire-dashboard" , dashboard . Name ) ;
513514 Assert . Same ( ManifestPublishingCallbackAnnotation . Ignore , annotation ) ;
0 commit comments