mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Polish "Honor gRPC overall health setting"
See gh-50799
This commit is contained in:
+2
-4
@@ -68,10 +68,8 @@ class AutoConfiguredHealthCheckedGrpcComponents implements HealthCheckedGrpcComp
|
||||
() -> StatusAggregator.of(properties.getStatus().getOrder()));
|
||||
StatusMapper statusMapper = getNonQualifiedBean(beanFactory, StatusMapper.class,
|
||||
() -> StatusMapper.of(properties.getStatus().getMapping()));
|
||||
this.server = (properties.isIncludeOverallHealth())
|
||||
? new AutoConfiguredHealthCheckedGrpcComponent(HealthContributorMembership.always(), statusAggregator,
|
||||
statusMapper)
|
||||
: null;
|
||||
this.server = (properties.isIncludeOverallHealth()) ? new AutoConfiguredHealthCheckedGrpcComponent(
|
||||
HealthContributorMembership.always(), statusAggregator, statusMapper) : null;
|
||||
this.services = createServices(properties.getService(), beanFactory, statusAggregator, statusMapper);
|
||||
}
|
||||
|
||||
|
||||
+7
-6
@@ -304,12 +304,13 @@ class GrpcServerHealthAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
void whenIncludeOverallHealthIsFalseDoesNotReportOverallHealth() {
|
||||
this.contextRunner.withPropertyValues("spring.grpc.server.health.include-overall-health=false").run((context) -> {
|
||||
GrpcServerHealth serverHealth = context.getBean(GrpcServerHealth.class);
|
||||
Map<String, ServingStatus> result = new LinkedHashMap<>();
|
||||
serverHealth.update(result::put);
|
||||
assertThat(result).isEmpty();
|
||||
});
|
||||
this.contextRunner.withPropertyValues("spring.grpc.server.health.include-overall-health=false")
|
||||
.run((context) -> {
|
||||
GrpcServerHealth serverHealth = context.getBean(GrpcServerHealth.class);
|
||||
Map<String, ServingStatus> result = new LinkedHashMap<>();
|
||||
serverHealth.update(result::put);
|
||||
assertThat(result).isEmpty();
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user