@@ -316,6 +316,35 @@ public async Task HostPing_Succeeds(string method)
316
316
Assert . Equal ( "no-store, no-cache" , cacheHeader ) ;
317
317
}
318
318
319
+ [ Theory ]
320
+ [ InlineData ( "/runtime/health" ) ]
321
+ [ InlineData ( "/runtime/health/live" ) ]
322
+ [ InlineData ( "/runtime/health/ready" ) ]
323
+ public async Task HealthCheck_AdminToken_Succeeds ( string uri )
324
+ {
325
+ // token specified as bearer token
326
+ HttpRequestMessage request = new ( HttpMethod . Get , uri ) ;
327
+ string token = _fixture . Host . GenerateAdminJwtToken ( ) ;
328
+ request . Headers . Authorization = new AuthenticationHeaderValue ( "Bearer" , token ) ;
329
+ HttpResponseMessage response = await _fixture . Host . HttpClient . SendAsync ( request ) ;
330
+ Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
331
+
332
+ string body = await response . Content . ReadAsStringAsync ( ) ;
333
+ Assert . Equal ( "{\" status\" :\" Healthy\" }" , body ) ;
334
+ }
335
+
336
+ [ Theory ]
337
+ [ InlineData ( "/runtime/health" ) ]
338
+ [ InlineData ( "/runtime/health/live" ) ]
339
+ [ InlineData ( "/runtime/health/ready" ) ]
340
+ public async Task HealthCheck_NoAdminToken_Fail ( string uri )
341
+ {
342
+ // token specified as bearer token
343
+ HttpRequestMessage request = new ( HttpMethod . Get , uri ) ;
344
+ HttpResponseMessage response = await _fixture . Host . HttpClient . SendAsync ( request ) ;
345
+ Assert . Equal ( HttpStatusCode . Unauthorized , response . StatusCode ) ;
346
+ }
347
+
319
348
[ Fact ]
320
349
public async Task InstallExtensionsEnsureOldPathReturns404 ( )
321
350
{
0 commit comments