@@ -21,34 +21,15 @@ public class HealthCheckIntegrationTests(ReflectorIntegrationFixture integration
2121{
2222 private readonly ReflectorIntegrationFixture _integrationFixture = integrationFixture ;
2323
24-
25- private static readonly ResiliencePipeline < bool > HealthCheckResiliencePipeline =
26- new ResiliencePipelineBuilder < bool > ( )
27- . AddRetry ( new RetryStrategyOptions < bool >
28- {
29- ShouldHandle = new PredicateBuilder < bool > ( )
30- . Handle < HttpOperationException > ( ex =>
31- ex . Response . StatusCode == HttpStatusCode . ServiceUnavailable )
32- . HandleResult ( false ) ,
33- MaxRetryAttempts = 10 ,
34- Delay = TimeSpan . FromSeconds ( 1 )
35- } )
36- . AddTimeout ( TimeSpan . FromSeconds ( 30 ) )
37- . Build ( ) ;
38-
39-
4024 [ Fact ]
4125 public async Task LivenessHealthCheck_Should_Return_Healthy ( )
4226 {
4327 var httpClient = _integrationFixture . Reflector . CreateClient ( ) ;
4428 var settings = _integrationFixture . Reflector . Services . GetRequiredService < IgniteSettings > ( ) ;
29+
4530 var response = await httpClient . GetAsync ( settings . AspNetCore . HealthChecks . LivenessEndpointPath ,
4631 TestContext . Current . CancellationToken ) ;
47-
4832 Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
49- Assert . Equal ( "text/plain" , response . Content . Headers . ContentType ? . MediaType ) ;
50- var content = await response . Content . ReadAsStringAsync ( TestContext . Current . CancellationToken ) ;
51- Assert . Equal ( "Healthy" , content ) ;
5233 }
5334
5435 [ Fact ]
@@ -57,14 +38,8 @@ public async Task ReadinessHealthCheck_Should_Return_Healthy()
5738 var settings = _integrationFixture . Reflector . Services . GetRequiredService < IgniteSettings > ( ) ;
5839 var httpClient = _integrationFixture . Reflector . CreateClient ( ) ;
5940
60- await HealthCheckResiliencePipeline . ExecuteAsync ( async token =>
61- {
62- var response = await httpClient . GetAsync ( settings . AspNetCore . HealthChecks . ReadinessEndpointPath ,
63- TestContext . Current . CancellationToken ) ;
64- response . EnsureSuccessStatusCode ( ) ;
65- return response . StatusCode == HttpStatusCode . OK ;
66- } , TestContext . Current . CancellationToken ) ;
67-
68-
41+ var response = await httpClient . GetAsync ( settings . AspNetCore . HealthChecks . ReadinessEndpointPath ,
42+ TestContext . Current . CancellationToken ) ;
43+ Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
6944 }
7045}
0 commit comments