@@ -19,7 +19,7 @@ public class DashboardResourceTests
19
19
[ Fact ]
20
20
public async Task DashboardIsAutomaticallyAddedAsHiddenResource ( )
21
21
{
22
- using var builder = TestDistributedApplicationBuilder . Create ( ) ;
22
+ using var builder = TestDistributedApplicationBuilder . Create ( options => options . DisableDashboard = false ) ;
23
23
24
24
// Ensure any ambient configuration doesn't impact this test.
25
25
builder . Configuration . AddInMemoryCollection ( new Dictionary < string , string ? >
@@ -34,7 +34,7 @@ public async Task DashboardIsAutomaticallyAddedAsHiddenResource()
34
34
o . DashboardPath = dashboardPath ;
35
35
} ) ;
36
36
37
- var app = builder . Build ( ) ;
37
+ using var app = builder . Build ( ) ;
38
38
39
39
await app . ExecuteBeforeStartHooksAsync ( default ) ;
40
40
@@ -52,11 +52,11 @@ public async Task DashboardIsAutomaticallyAddedAsHiddenResource()
52
52
[ Fact ]
53
53
public async Task DashboardIsAddedFirst ( )
54
54
{
55
- using var builder = TestDistributedApplicationBuilder . Create ( ) ;
55
+ using var builder = TestDistributedApplicationBuilder . Create ( options => options . DisableDashboard = false ) ;
56
56
57
57
builder . AddContainer ( "my-container" , "my-image" ) ;
58
58
59
- var app = builder . Build ( ) ;
59
+ using var app = builder . Build ( ) ;
60
60
61
61
await app . ExecuteBeforeStartHooksAsync ( default ) ;
62
62
@@ -71,7 +71,7 @@ public async Task DashboardIsAddedFirst()
71
71
[ Fact ]
72
72
public async Task DashboardDoesNotAddResource_ConfiguresExistingDashboard ( )
73
73
{
74
- using var builder = TestDistributedApplicationBuilder . Create ( ) ;
74
+ using var builder = TestDistributedApplicationBuilder . Create ( options => options . DisableDashboard = false ) ;
75
75
76
76
builder . Services . AddSingleton < IDashboardEndpointProvider , MockDashboardEndpointProvider > ( ) ;
77
77
@@ -85,7 +85,7 @@ public async Task DashboardDoesNotAddResource_ConfiguresExistingDashboard()
85
85
86
86
var container = builder . AddContainer ( KnownResourceNames . AspireDashboard , "my-image" ) ;
87
87
88
- var app = builder . Build ( ) ;
88
+ using var app = builder . Build ( ) ;
89
89
90
90
await app . ExecuteBeforeStartHooksAsync ( default ) ;
91
91
@@ -144,7 +144,7 @@ public async Task DashboardDoesNotAddResource_ConfiguresExistingDashboard()
144
144
[ Fact ]
145
145
public async Task DashboardWithDllPathLaunchesDotnet ( )
146
146
{
147
- using var builder = TestDistributedApplicationBuilder . Create ( ) ;
147
+ using var builder = TestDistributedApplicationBuilder . Create ( options => options . DisableDashboard = false ) ;
148
148
149
149
var dashboardPath = Path . GetFullPath ( "dashboard.dll" ) ;
150
150
@@ -173,7 +173,7 @@ public async Task DashboardWithDllPathLaunchesDotnet()
173
173
public async Task DashboardAuthConfigured_EnvVarsPresent ( )
174
174
{
175
175
// Arrange
176
- using var builder = TestDistributedApplicationBuilder . Create ( ) ;
176
+ using var builder = TestDistributedApplicationBuilder . Create ( options => options . DisableDashboard = false ) ;
177
177
178
178
builder . Services . AddSingleton < IDashboardEndpointProvider , MockDashboardEndpointProvider > ( ) ;
179
179
@@ -187,7 +187,7 @@ public async Task DashboardAuthConfigured_EnvVarsPresent()
187
187
[ "AppHost:OtlpApiKey" ] = "TestOtlpApiKey!"
188
188
} ) ;
189
189
190
- var app = builder . Build ( ) ;
190
+ using var app = builder . Build ( ) ;
191
191
192
192
await app . ExecuteBeforeStartHooksAsync ( default ) ;
193
193
@@ -208,7 +208,7 @@ public async Task DashboardAuthConfigured_EnvVarsPresent()
208
208
public async Task DashboardAuthRemoved_EnvVarsUnsecured ( )
209
209
{
210
210
// Arrange
211
- using var builder = TestDistributedApplicationBuilder . Create ( ) ;
211
+ using var builder = TestDistributedApplicationBuilder . Create ( options => options . DisableDashboard = false ) ;
212
212
213
213
builder . Services . AddSingleton < IDashboardEndpointProvider , MockDashboardEndpointProvider > ( ) ;
214
214
@@ -220,7 +220,7 @@ public async Task DashboardAuthRemoved_EnvVarsUnsecured()
220
220
[ "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL" ] = "http://localhost"
221
221
} ) ;
222
222
223
- var app = builder . Build ( ) ;
223
+ using var app = builder . Build ( ) ;
224
224
225
225
await app . ExecuteBeforeStartHooksAsync ( default ) ;
226
226
@@ -238,7 +238,7 @@ public async Task DashboardAuthRemoved_EnvVarsUnsecured()
238
238
public async Task DashboardResourceServiceUriIsSet ( )
239
239
{
240
240
// Arrange
241
- using var builder = TestDistributedApplicationBuilder . Create ( ) ;
241
+ using var builder = TestDistributedApplicationBuilder . Create ( options => options . DisableDashboard = false ) ;
242
242
243
243
builder . Services . AddSingleton < IDashboardEndpointProvider , MockDashboardEndpointProvider > ( ) ;
244
244
@@ -250,7 +250,7 @@ public async Task DashboardResourceServiceUriIsSet()
250
250
[ "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL" ] = "http://localhost"
251
251
} ) ;
252
252
253
- var app = builder . Build ( ) ;
253
+ using var app = builder . Build ( ) ;
254
254
255
255
await app . ExecuteBeforeStartHooksAsync ( default ) ;
256
256
@@ -266,9 +266,13 @@ public async Task DashboardResourceServiceUriIsSet()
266
266
[ Fact ]
267
267
public async Task DashboardIsNotAddedInPublishMode ( )
268
268
{
269
- using var builder = TestDistributedApplicationBuilder . Create ( DistributedApplicationOperation . Publish ) ;
269
+ using var builder = TestDistributedApplicationBuilder . Create ( options =>
270
+ {
271
+ options . DisableDashboard = false ;
272
+ options . Args = [ "--publisher" , "manifest" ] ;
273
+ } ) ;
270
274
271
- var app = builder . Build ( ) ;
275
+ using var app = builder . Build ( ) ;
272
276
273
277
await app . ExecuteBeforeStartHooksAsync ( default ) ;
274
278
@@ -280,7 +284,7 @@ public async Task DashboardIsNotAddedInPublishMode()
280
284
[ Fact ]
281
285
public async Task DashboardIsNotAddedIfDisabled ( )
282
286
{
283
- using var builder = TestDistributedApplicationBuilder . Create ( new DistributedApplicationOptions { DisableDashboard = true } ) ;
287
+ using var builder = TestDistributedApplicationBuilder . Create ( options => options . DisableDashboard = true ) ;
284
288
285
289
var app = builder . Build ( ) ;
286
290
@@ -295,12 +299,11 @@ public async Task DashboardIsNotAddedIfDisabled()
295
299
public void ContainerIsValidWithDashboardIsDisabled ( )
296
300
{
297
301
// Set the host environment to "Development" so that the container validates services.
298
- using var builder = TestDistributedApplicationBuilder . Create ( new DistributedApplicationOptions
302
+ using var builder = TestDistributedApplicationBuilder . Create ( options =>
299
303
{
300
- DisableDashboard = true ,
301
- Args = [ "--environment" , "Development" ]
302
- }
303
- ) ;
304
+ options . DisableDashboard = true ;
305
+ options . Args = [ "--environment" , "Development" ] ;
306
+ } ) ;
304
307
305
308
// Container validation logic runs when the service provider is built.
306
309
using var app = builder . Build ( ) ;
@@ -315,7 +318,7 @@ public void ContainerIsValidWithDashboardIsDisabled()
315
318
[ InlineData ( LogLevel . Trace ) ]
316
319
public async Task DashboardLifecycleHookWatchesLogs ( LogLevel logLevel )
317
320
{
318
- using var builder = TestDistributedApplicationBuilder . Create ( ) ;
321
+ using var builder = TestDistributedApplicationBuilder . Create ( o => o . DisableDashboard = false ) ;
319
322
320
323
var loggerProvider = new TestLoggerProvider ( ) ;
321
324
@@ -337,7 +340,7 @@ public async Task DashboardLifecycleHookWatchesLogs(LogLevel logLevel)
337
340
await app . ExecuteBeforeStartHooksAsync ( default ) ;
338
341
339
342
var model = app . Services . GetRequiredService < DistributedApplicationModel > ( ) ;
340
- var resourceNotifcationService = app . Services . GetRequiredService < ResourceNotificationService > ( ) ;
343
+ var resourceNotificationService = app . Services . GetRequiredService < ResourceNotificationService > ( ) ;
341
344
var resourceLoggerService = app . Services . GetRequiredService < ResourceLoggerService > ( ) ;
342
345
343
346
var dashboard = Assert . Single ( model . Resources . OfType < ExecutableResource > ( ) ) ;
@@ -346,7 +349,7 @@ public async Task DashboardLifecycleHookWatchesLogs(LogLevel logLevel)
346
349
Assert . Equal ( "aspire-dashboard" , dashboard . Name ) ;
347
350
348
351
// Push a notification through to the dashboard resource.
349
- await resourceNotifcationService . PublishUpdateAsync ( dashboard , "aspire-dashboard-0" , s => s with { State = "Running" } ) ;
352
+ await resourceNotificationService . PublishUpdateAsync ( dashboard , "aspire-dashboard-0" , s => s with { State = "Running" } ) ;
350
353
351
354
// Push some logs through to the dashboard resource.
352
355
var logger = resourceLoggerService . GetLogger ( "aspire-dashboard-0" ) ;
0 commit comments