use of org.springframework.boot.actuate.health.HealthEndpointGroups in project spring-boot by spring-projects.
the class HealthEndpointAutoConfigurationTests method runWhenHasHealthEndpointGroupsPostProcessorPerformsProcessing.
@Test
void runWhenHasHealthEndpointGroupsPostProcessorPerformsProcessing() {
this.contextRunner.withPropertyValues("management.endpoint.health.group.ready.include=*").withUserConfiguration(HealthEndpointGroupsConfiguration.class, TestHealthEndpointGroupsPostProcessor.class).run((context) -> {
HealthEndpointGroups groups = context.getBean(HealthEndpointGroups.class);
assertThatExceptionOfType(RuntimeException.class).isThrownBy(() -> groups.get("test")).withMessage("postprocessed");
});
}
use of org.springframework.boot.actuate.health.HealthEndpointGroups in project spring-boot by spring-projects.
the class HealthEndpointAutoConfigurationTests method runWhenHasHealthEndpointGroupsBeanDoesNotCreateAdditionalHealthEndpointGroups.
@Test
void runWhenHasHealthEndpointGroupsBeanDoesNotCreateAdditionalHealthEndpointGroups() {
this.contextRunner.withUserConfiguration(HealthEndpointGroupsConfiguration.class).withPropertyValues("management.endpoint.health.group.ready.include=*").run((context) -> {
HealthEndpointGroups groups = context.getBean(HealthEndpointGroups.class);
assertThat(groups.getNames()).containsOnly("mock");
});
}
use of org.springframework.boot.actuate.health.HealthEndpointGroups in project spring-boot by spring-projects.
the class AvailabilityProbesHealthEndpointGroupsPostProcessorTests method postProcessHealthEndpointGroupsWhenGroupContainsOneReturnsPostProcessed.
@Test
void postProcessHealthEndpointGroupsWhenGroupContainsOneReturnsPostProcessed() {
HealthEndpointGroups groups = mock(HealthEndpointGroups.class);
Set<String> names = new LinkedHashSet<>();
names.add("test");
names.add("readiness");
given(groups.getNames()).willReturn(names);
assertThat(this.postProcessor.postProcessHealthEndpointGroups(groups)).isInstanceOf(AvailabilityProbesHealthEndpointGroups.class);
}
use of org.springframework.boot.actuate.health.HealthEndpointGroups in project spring-boot by spring-projects.
the class AvailabilityProbesHealthEndpointGroupsPostProcessorTests method postProcessHealthEndpointGroupsWhenGroupsContainsNoneReturnsProcessed.
@Test
void postProcessHealthEndpointGroupsWhenGroupsContainsNoneReturnsProcessed() {
HealthEndpointGroups groups = mock(HealthEndpointGroups.class);
Set<String> names = new LinkedHashSet<>();
names.add("test");
names.add("spring");
names.add("boot");
given(groups.getNames()).willReturn(names);
assertThat(this.postProcessor.postProcessHealthEndpointGroups(groups)).isInstanceOf(AvailabilityProbesHealthEndpointGroups.class);
}
use of org.springframework.boot.actuate.health.HealthEndpointGroups in project spring-boot by spring-projects.
the class AvailabilityProbesHealthEndpointGroupsPostProcessorTests method getPostProcessed.
private HealthEndpointGroups getPostProcessed(String value) {
MockEnvironment environment = new MockEnvironment();
environment.setProperty("management.endpoint.health.probes.add-additional-paths", value);
AvailabilityProbesHealthEndpointGroupsPostProcessor postProcessor = new AvailabilityProbesHealthEndpointGroupsPostProcessor(environment);
HealthEndpointGroups groups = mock(HealthEndpointGroups.class);
return postProcessor.postProcessHealthEndpointGroups(groups);
}
Aggregations