7
7
using Aspire . Hosting . Dcp ;
8
8
using Aspire . Hosting . Tests . Utils ;
9
9
using Aspire . Hosting . Utils ;
10
+ using Microsoft . AspNetCore . InternalTesting ;
10
11
using Microsoft . Extensions . Configuration ;
11
12
using Microsoft . Extensions . DependencyInjection ;
12
13
using Microsoft . Extensions . Logging ;
@@ -40,7 +41,7 @@ public async Task DashboardIsAutomaticallyAddedAsHiddenResource()
40
41
41
42
using var app = builder . Build ( ) ;
42
43
43
- await app . ExecuteBeforeStartHooksAsync ( default ) ;
44
+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
44
45
45
46
var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
46
47
@@ -64,7 +65,7 @@ public async Task DashboardIsAddedFirst()
64
65
65
66
using var app = builder . Build ( ) ;
66
67
67
- await app . ExecuteBeforeStartHooksAsync ( default ) ;
68
+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
68
69
69
70
var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
70
71
@@ -95,15 +96,15 @@ public async Task DashboardDoesNotAddResource_ConfiguresExistingDashboard()
95
96
96
97
using var app = builder . Build ( ) ;
97
98
98
- await app . ExecuteBeforeStartHooksAsync ( default ) ;
99
+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
99
100
100
101
var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
101
102
102
103
var dashboard = Assert . Single ( model . Resources ) ;
103
104
104
105
Assert . Same ( container . Resource , dashboard ) ;
105
106
106
- var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , TestServiceProvider . Instance ) ;
107
+ var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , TestServiceProvider . Instance ) . DefaultTimeout ( ) ;
107
108
108
109
Assert . Collection ( config ,
109
110
e =>
@@ -165,13 +166,13 @@ public async Task DashboardWithDllPathLaunchesDotnet()
165
166
166
167
var app = builder . Build ( ) ;
167
168
168
- await app . ExecuteBeforeStartHooksAsync ( default ) ;
169
+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
169
170
170
171
var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
171
172
172
173
var dashboard = Assert . Single ( model . Resources . OfType < ExecutableResource > ( ) ) ;
173
174
174
- var args = await ArgumentEvaluator . GetArgumentListAsync ( dashboard ) ;
175
+ var args = await ArgumentEvaluator . GetArgumentListAsync ( dashboard ) . DefaultTimeout ( ) ;
175
176
176
177
Assert . NotNull ( dashboard ) ;
177
178
Assert . Equal ( "aspire-dashboard" , dashboard . Name ) ;
@@ -201,13 +202,13 @@ public async Task DashboardAuthConfigured_EnvVarsPresent()
201
202
202
203
using var app = builder . Build ( ) ;
203
204
204
- await app . ExecuteBeforeStartHooksAsync ( default ) ;
205
+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
205
206
206
207
var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
207
208
208
209
var dashboard = Assert . Single ( model . Resources ) ;
209
210
210
- var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , TestServiceProvider . Instance ) ;
211
+ var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , TestServiceProvider . Instance ) . DefaultTimeout ( ) ;
211
212
212
213
Assert . Equal ( "BrowserToken" , config . Single ( e => e . Key == DashboardConfigNames . DashboardFrontendAuthModeName . EnvVarName ) . Value ) ;
213
214
Assert . Equal ( "TestBrowserToken!" , config . Single ( e => e . Key == DashboardConfigNames . DashboardFrontendBrowserTokenName . EnvVarName ) . Value ) ;
@@ -236,13 +237,13 @@ public async Task DashboardAuthRemoved_EnvVarsUnsecured()
236
237
237
238
using var app = builder . Build ( ) ;
238
239
239
- await app . ExecuteBeforeStartHooksAsync ( default ) ;
240
+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
240
241
241
242
var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
242
243
243
244
var dashboard = Assert . Single ( model . Resources ) ;
244
245
245
- var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , TestServiceProvider . Instance ) ;
246
+ var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , TestServiceProvider . Instance ) . DefaultTimeout ( ) ;
246
247
247
248
Assert . Equal ( "Unsecured" , config . Single ( e => e . Key == DashboardConfigNames . DashboardFrontendAuthModeName . EnvVarName ) . Value ) ;
248
249
Assert . Equal ( "Unsecured" , config . Single ( e => e . Key == DashboardConfigNames . DashboardOtlpAuthModeName . EnvVarName ) . Value ) ;
@@ -268,13 +269,13 @@ public async Task DashboardResourceServiceUriIsSet()
268
269
269
270
using var app = builder . Build ( ) ;
270
271
271
- await app . ExecuteBeforeStartHooksAsync ( default ) ;
272
+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
272
273
273
274
var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
274
275
275
276
var dashboard = Assert . Single ( model . Resources ) ;
276
277
277
- var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , TestServiceProvider . Instance ) ;
278
+ var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , TestServiceProvider . Instance ) . DefaultTimeout ( ) ;
278
279
279
280
Assert . Equal ( "http://localhost:5000" , config . Single ( e => e . Key == DashboardConfigNames . ResourceServiceUrlName . EnvVarName ) . Value ) ;
280
281
}
@@ -301,7 +302,7 @@ public async Task DashboardResource_OtlpHttpEndpoint_CorsEnvVarSet()
301
302
302
303
using var app = builder . Build ( ) ;
303
304
304
- await app . ExecuteBeforeStartHooksAsync ( default ) ;
305
+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
305
306
306
307
var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
307
308
@@ -312,7 +313,7 @@ public async Task DashboardResource_OtlpHttpEndpoint_CorsEnvVarSet()
312
313
313
314
var dashboard = Assert . Single ( model . Resources . Where ( r => r . Name == "aspire-dashboard" ) ) ;
314
315
315
- var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , app . Services ) ;
316
+ var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , app . Services ) . DefaultTimeout ( ) ;
316
317
317
318
Assert . Equal ( "http://localhost:8081,http://localhost:58080" , config . Single ( e => e . Key == DashboardConfigNames . DashboardOtlpCorsAllowedOriginsKeyName . EnvVarName ) . Value ) ;
318
319
Assert . Equal ( "*" , config . Single ( e => e . Key == DashboardConfigNames . DashboardOtlpCorsAllowedHeadersKeyName . EnvVarName ) . Value ) ;
@@ -340,13 +341,13 @@ public async Task DashboardResource_OtlpGrpcEndpoint_CorsEnvVarNotSet()
340
341
341
342
using var app = builder . Build ( ) ;
342
343
343
- await app . ExecuteBeforeStartHooksAsync ( default ) ;
344
+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
344
345
345
346
var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
346
347
347
348
var dashboard = Assert . Single ( model . Resources . Where ( r => r . Name == "aspire-dashboard" ) ) ;
348
349
349
- var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , app . Services ) ;
350
+ var config = await EnvironmentVariableEvaluator . GetEnvironmentVariablesAsync ( dashboard , DistributedApplicationOperation . Run , app . Services ) . DefaultTimeout ( ) ;
350
351
351
352
Assert . DoesNotContain ( config , e => e . Key == DashboardConfigNames . DashboardOtlpCorsAllowedOriginsKeyName . EnvVarName ) ;
352
353
Assert . DoesNotContain ( config , e => e . Key == DashboardConfigNames . DashboardOtlpCorsAllowedHeadersKeyName . EnvVarName ) ;
@@ -365,7 +366,7 @@ public async Task DashboardIsNotAddedInPublishMode()
365
366
366
367
using var app = builder . Build ( ) ;
367
368
368
- await app . ExecuteBeforeStartHooksAsync ( default ) ;
369
+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
369
370
370
371
var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
371
372
@@ -381,7 +382,7 @@ public async Task DashboardIsNotAddedIfDisabled()
381
382
382
383
var app = builder . Build ( ) ;
383
384
384
- await app . ExecuteBeforeStartHooksAsync ( default ) ;
385
+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
385
386
386
387
var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
387
388
@@ -446,7 +447,7 @@ public async Task DashboardLifecycleHookWatchesLogs(LogLevel logLevel)
446
447
}
447
448
} ) ;
448
449
449
- await app . ExecuteBeforeStartHooksAsync ( default ) . WaitAsync ( TimeSpan . FromSeconds ( 15 ) ) ;
450
+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
450
451
451
452
var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
452
453
var resourceNotificationService = app . Services . GetRequiredService < ResourceNotificationService > ( ) ;
@@ -457,10 +458,10 @@ public async Task DashboardLifecycleHookWatchesLogs(LogLevel logLevel)
457
458
Assert . Equal ( "aspire-dashboard" , dashboard . Name ) ;
458
459
459
460
// 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 ( ) ;
461
462
462
463
// Wait for logs to be subscribed to
463
- await watchForLogSubs . WaitAsync ( TimeSpan . FromSeconds ( 15 ) ) ;
464
+ await watchForLogSubs . DefaultTimeout ( ) ;
464
465
465
466
// Push some logs through to the dashboard resource.
466
467
var logger = resourceLoggerService . GetLogger ( "aspire-dashboard-0" ) ;
@@ -481,12 +482,12 @@ public async Task DashboardLifecycleHookWatchesLogs(LogLevel logLevel)
481
482
Assert . NotNull ( testLogger ) ;
482
483
483
484
// 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 ( ) ;
485
486
486
487
Assert . Equal ( "Test dashboard message" , log . Message ) ;
487
488
Assert . Equal ( logLevel , log . LogLevel ) ;
488
489
489
- await app . DisposeAsync ( ) . AsTask ( ) . WaitAsync ( TimeSpan . FromSeconds ( 15 ) ) ;
490
+ await app . DisposeAsync ( ) . AsTask ( ) . DefaultTimeout ( ) ;
490
491
}
491
492
492
493
[ Fact ]
@@ -498,7 +499,7 @@ public async Task DashboardIsExcludedFromManifestInPublishModeEvenIfAddedExplici
498
499
499
500
var app = builder . Build ( ) ;
500
501
501
- await app . ExecuteBeforeStartHooksAsync ( default ) ;
502
+ await app . ExecuteBeforeStartHooksAsync ( default ) . DefaultTimeout ( ) ;
502
503
503
504
var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
504
505
@@ -507,7 +508,7 @@ public async Task DashboardIsExcludedFromManifestInPublishModeEvenIfAddedExplici
507
508
Assert . NotNull ( dashboard ) ;
508
509
var annotation = Assert . Single ( dashboard . Annotations . OfType < ManifestPublishingCallbackAnnotation > ( ) ) ;
509
510
510
- var manifest = await ManifestUtils . GetManifestOrNull ( dashboard ) ;
511
+ var manifest = await ManifestUtils . GetManifestOrNull ( dashboard ) . DefaultTimeout ( ) ;
511
512
512
513
Assert . Equal ( "aspire-dashboard" , dashboard . Name ) ;
513
514
Assert . Same ( ManifestPublishingCallbackAnnotation . Ignore , annotation ) ;
0 commit comments