You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We just updated to Spring Boot 2.2.0 and also moved to the Hoxton Release Train.
We have the following integration test for our custom health checks:
@RunWith(SpringRunner.class)
@EnableAutoConfiguration
@SpringBootTest(classes = {LivenessCheckAutoConfiguration.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@TestPropertySource(properties = {"management.endpoint.health.custom: false"})
public class CustomReadinessCheckDisabledIntTest {
@Autowired
private TestRestTemplate restTemplate;
@Test
public void testCustomHealthCheckDisabled() {
String body = this.restTemplate.getForObject("/health", String.class);
assertThat(body, is(notNullValue()));
assertThat(body, is("{\"status\":\"UP\",\"components\":{\"ping\":{\"status\":\"UP\"}}}"));
}
}
We also have the following properties set: management.health.defaults.enabled: false and management.health.ping.enabled: true
Since the Hoxton.M3 Release the DiscoveryClientHealthIndicator is now active which results in the test to fail with:
java.lang.AssertionError:
Expected: is "{\"status\":\"UP\",\"components\":{\"ping\":{\"status\":\"UP\"}}}"
but: was "{\"status\":\"UP\",\"components\":{\"discoveryComposite\":{\"description\":\"Discovery Client not initialized\",\"status\":\"UNKNOWN\",\"components\":{\"discoveryClient\":{\"description\":\"Discovery Client not initialized\",\"status\":\"UNKNOWN\"}}},\"ping\":{\"status\":\"UP\"}}}"
Is this intended behaviour or a bug?
Should the DiscoveryClientHealthIndicator be affected by management.health.defaults.enabled: false?
There was a related change in the Spring Boot 2.2.0 Update: See: spring-projects/spring-boot#17926 and spring-projects/spring-boot#18676
If it is an issue:
We tracked it down to the DiscoveryClientHealthIndicator bean that is registered in CommonsClientAutoConfiguration.DiscoveryLoadBalancerConfiguration.
In Greenwich.SR2 and Hoxton.M2 the CommonsClientAutoConfiguration.DiscoveryLoadBalancerConfiguration is not loaded, because of:
CommonsClientAutoConfiguration.DiscoveryLoadBalancerConfiguration:
Did not match:
- @ConditionalOnBean (types: org.springframework.cloud.client.discovery.DiscoveryClient; SearchStrategy: all) did not find any beans of type org.springframework.cloud.client.discovery.DiscoveryClient (OnBeanCondition)
Matched:
- @ConditionalOnClass found required class 'org.springframework.boot.actuate.health.HealthIndicator' (OnClassCondition)
- @ConditionalOnProperty (spring.cloud.discovery.enabled) matched (OnPropertyCondition)
Now this bean is loaded due the change of the @AutoConfigureBefore in SimpleDiscoveryClientAutoConfiguration.
See:
Hello @dkroehan , I think this is something that the team has to discuss.
In the meantime, as stated in the docs:
Commons creates a Spring Boot HealthIndicator that DiscoveryClient implementations can participate in by implementing DiscoveryHealthIndicator.
To disable the composite HealthIndicator, set spring.cloud.discovery.client.composite-indicator.enabled=false.
A generic HealthIndicator based on DiscoveryClient is auto-configured (DiscoveryClientHealthIndicator).
We just updated to
Spring Boot 2.2.0
and also moved to theHoxton
Release Train.We have the following integration test for our custom health checks:
We also have the following properties set:
management.health.defaults.enabled: false
andmanagement.health.ping.enabled: true
Since the
Hoxton.M3
Release theDiscoveryClientHealthIndicator
is now active which results in the test to fail with:Is this intended behaviour or a bug?
Should the
DiscoveryClientHealthIndicator
be affected bymanagement.health.defaults.enabled: false
?There was a related change in the Spring Boot 2.2.0 Update: See: spring-projects/spring-boot#17926 and spring-projects/spring-boot#18676
If it is an issue:
We tracked it down to the
DiscoveryClientHealthIndicator
bean that is registered inCommonsClientAutoConfiguration.DiscoveryLoadBalancerConfiguration
.In
Greenwich.SR2
andHoxton.M2
theCommonsClientAutoConfiguration.DiscoveryLoadBalancerConfiguration
is not loaded, because of:Now this bean is loaded due the change of the
@AutoConfigureBefore
inSimpleDiscoveryClientAutoConfiguration
.See:
spring-cloud-commons/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/simple/SimpleDiscoveryClientAutoConfiguration.java
Line 43 in c437379
The text was updated successfully, but these errors were encountered: