88using Aspire . Dashboard . Configuration ;
99using Aspire . Dashboard . Utils ;
1010using Aspire . Hosting ;
11+ using Microsoft . AspNetCore . InternalTesting ;
1112using Microsoft . Extensions . Logging ;
1213using Microsoft . Extensions . Logging . Testing ;
1314using Xunit ;
@@ -34,12 +35,12 @@ public async Task Get_Unauthenticated_RedirectToLogin()
3435 config [ DashboardConfigNames . DashboardFrontendAuthModeName . ConfigKey ] = FrontendAuthMode . BrowserToken . ToString ( ) ;
3536 config [ DashboardConfigNames . DashboardFrontendBrowserTokenName . ConfigKey ] = apiKey ;
3637 } ) ;
37- await app . StartAsync ( ) ;
38+ await app . StartAsync ( ) . DefaultTimeout ( ) ;
3839
3940 using var client = new HttpClient { BaseAddress = new Uri ( $ "http://{ app . FrontendSingleEndPointAccessor ( ) . EndPoint } ") } ;
4041
4142 // Act
42- var response = await client . GetAsync ( "/" ) ;
43+ var response = await client . GetAsync ( "/" ) . DefaultTimeout ( ) ;
4344
4445 // Assert
4546 Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
@@ -56,19 +57,19 @@ public async Task Get_LoginPage_ValidToken_RedirectToApp()
5657 config [ DashboardConfigNames . DashboardFrontendAuthModeName . ConfigKey ] = FrontendAuthMode . BrowserToken . ToString ( ) ;
5758 config [ DashboardConfigNames . DashboardFrontendBrowserTokenName . ConfigKey ] = apiKey ;
5859 } ) ;
59- await app . StartAsync ( ) ;
60+ await app . StartAsync ( ) . DefaultTimeout ( ) ;
6061
6162 using var client = new HttpClient { BaseAddress = new Uri ( $ "http://{ app . FrontendSingleEndPointAccessor ( ) . EndPoint } ") } ;
6263
6364 // Act 1
64- var response1 = await client . GetAsync ( DashboardUrls . LoginUrl ( returnUrl : DashboardUrls . TracesUrl ( ) , token : apiKey ) ) ;
65+ var response1 = await client . GetAsync ( DashboardUrls . LoginUrl ( returnUrl : DashboardUrls . TracesUrl ( ) , token : apiKey ) ) . DefaultTimeout ( ) ;
6566
6667 // Assert 1
6768 Assert . Equal ( HttpStatusCode . OK , response1 . StatusCode ) ;
6869 Assert . Equal ( DashboardUrls . TracesUrl ( ) , response1 . RequestMessage ! . RequestUri ! . PathAndQuery ) ;
6970
7071 // Act 2
71- var response2 = await client . GetAsync ( DashboardUrls . StructuredLogsUrl ( ) ) ;
72+ var response2 = await client . GetAsync ( DashboardUrls . StructuredLogsUrl ( ) ) . DefaultTimeout ( ) ;
7273
7374 // Assert 2
7475 Assert . Equal ( HttpStatusCode . OK , response2 . StatusCode ) ;
@@ -87,12 +88,12 @@ public async Task Get_LoginPage_ValidToken_OtlpHttpConnection_Denied()
8788 config [ DashboardConfigNames . DashboardFrontendAuthModeName . ConfigKey ] = FrontendAuthMode . BrowserToken . ToString ( ) ;
8889 config [ DashboardConfigNames . DashboardFrontendBrowserTokenName . ConfigKey ] = apiKey ;
8990 } , testSink : testSink ) ;
90- await app . StartAsync ( ) ;
91+ await app . StartAsync ( ) . DefaultTimeout ( ) ;
9192
9293 using var client = new HttpClient { BaseAddress = new Uri ( $ "http://{ app . OtlpServiceHttpEndPointAccessor ( ) . EndPoint } ") } ;
9394
9495 // Act
95- var response = await client . GetAsync ( DashboardUrls . LoginUrl ( returnUrl : DashboardUrls . TracesUrl ( ) , token : apiKey ) ) ;
96+ var response = await client . GetAsync ( DashboardUrls . LoginUrl ( returnUrl : DashboardUrls . TracesUrl ( ) , token : apiKey ) ) . DefaultTimeout ( ) ;
9697
9798 // Assert
9899 Assert . Equal ( HttpStatusCode . NotFound , response . StatusCode ) ;
@@ -111,12 +112,12 @@ public async Task Get_LoginPage_InvalidToken_RedirectToLoginWithoutToken()
111112 config [ DashboardConfigNames . DashboardFrontendAuthModeName . ConfigKey ] = FrontendAuthMode . BrowserToken . ToString ( ) ;
112113 config [ DashboardConfigNames . DashboardFrontendBrowserTokenName . ConfigKey ] = apiKey ;
113114 } ) ;
114- await app . StartAsync ( ) ;
115+ await app . StartAsync ( ) . DefaultTimeout ( ) ;
115116
116117 using var client = new HttpClient { BaseAddress = new Uri ( $ "http://{ app . FrontendSingleEndPointAccessor ( ) . EndPoint } ") } ;
117118
118119 // Act
119- var response = await client . GetAsync ( DashboardUrls . LoginUrl ( returnUrl : DashboardUrls . TracesUrl ( ) , token : "Wrong!" ) ) ;
120+ var response = await client . GetAsync ( DashboardUrls . LoginUrl ( returnUrl : DashboardUrls . TracesUrl ( ) , token : "Wrong!" ) ) . DefaultTimeout ( ) ;
120121
121122 // Assert
122123 Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
@@ -136,12 +137,12 @@ public async Task Post_ValidateTokenApi_AvailableBasedOnOptions(FrontendAuthMode
136137 config [ DashboardConfigNames . DashboardFrontendAuthModeName . ConfigKey ] = authMode . ToString ( ) ;
137138 config [ DashboardConfigNames . DashboardFrontendBrowserTokenName . ConfigKey ] = apiKey ;
138139 } ) ;
139- await app . StartAsync ( ) ;
140+ await app . StartAsync ( ) . DefaultTimeout ( ) ;
140141
141142 using var client = new HttpClient { BaseAddress = new Uri ( $ "http://{ app . FrontendSingleEndPointAccessor ( ) . EndPoint } ") } ;
142143
143144 // Act
144- var response = await client . PostAsync ( "/api/validatetoken?token=" + requestToken , content : null ) ;
145+ var response = await client . PostAsync ( "/api/validatetoken?token=" + requestToken , content : null ) . DefaultTimeout ( ) ;
145146
146147 // Assert
147148 Assert . Equal ( statusCode , response . StatusCode ) ;
@@ -164,7 +165,7 @@ public async Task LogOutput_NoToken_GeneratedTokenLogged()
164165 } , testSink : testSink ) ;
165166
166167 // Act
167- await app . StartAsync ( ) ;
168+ await app . StartAsync ( ) . DefaultTimeout ( ) ;
168169
169170 // Assert
170171 var l = testSink . Writes . Where ( w => w . LoggerName == typeof ( DashboardWebApplication ) . FullName ) . ToList ( ) ;
@@ -225,7 +226,7 @@ public async Task LogOutput_AnyIP_LoginLinkLocalhost(string frontendUrl, string
225226 } , testSink : testSink ) ;
226227
227228 // Act
228- await app . StartAsync ( ) ;
229+ await app . StartAsync ( ) . DefaultTimeout ( ) ;
229230
230231 // Assert
231232 var l = testSink . Writes . Where ( w => w . LoggerName == typeof ( DashboardWebApplication ) . FullName ) . ToList ( ) ;
@@ -252,7 +253,7 @@ public async Task LogOutput_InContainer_LoginLinkContainerMessage()
252253 } , testSink : testSink ) ;
253254
254255 // Act
255- await app . StartAsync ( ) ;
256+ await app . StartAsync ( ) . DefaultTimeout ( ) ;
256257
257258 // Assert
258259 var l = testSink . Writes . Where ( w => w . LoggerName == typeof ( DashboardWebApplication ) . FullName ) . ToList ( ) ;
0 commit comments