Search in sources :

Example 21 with HealthEndpointGroups

use of org.springframework.boot.actuate.health.HealthEndpointGroups in project spring-boot by spring-projects.

the class AvailabilityProbesHealthEndpointGroupsPostProcessorTests method postProcessHealthEndpointGroupsWhenAdditionalPathPropertyIsNull.

@Test
void postProcessHealthEndpointGroupsWhenAdditionalPathPropertyIsNull() {
    HealthEndpointGroups groups = mock(HealthEndpointGroups.class);
    HealthEndpointGroups postProcessed = this.postProcessor.postProcessHealthEndpointGroups(groups);
    HealthEndpointGroup liveness = postProcessed.get("liveness");
    HealthEndpointGroup readiness = postProcessed.get("readiness");
    assertThat(liveness.getAdditionalPath()).isNull();
    assertThat(readiness.getAdditionalPath()).isNull();
}
Also used : HealthEndpointGroups(org.springframework.boot.actuate.health.HealthEndpointGroups) HealthEndpointGroup(org.springframework.boot.actuate.health.HealthEndpointGroup) Test(org.junit.jupiter.api.Test)

Example 22 with HealthEndpointGroups

use of org.springframework.boot.actuate.health.HealthEndpointGroups in project spring-boot by spring-projects.

the class AvailabilityProbesHealthEndpointGroupsPostProcessorTests method postProcessHealthEndpointGroupsWhenGroupsAlreadyContainedReturnsOriginal.

@Test
void postProcessHealthEndpointGroupsWhenGroupsAlreadyContainedReturnsOriginal() {
    HealthEndpointGroups groups = mock(HealthEndpointGroups.class);
    Set<String> names = new LinkedHashSet<>();
    names.add("test");
    names.add("readiness");
    names.add("liveness");
    given(groups.getNames()).willReturn(names);
    assertThat(this.postProcessor.postProcessHealthEndpointGroups(groups)).isSameAs(groups);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) HealthEndpointGroups(org.springframework.boot.actuate.health.HealthEndpointGroups) Test(org.junit.jupiter.api.Test)

Example 23 with HealthEndpointGroups

use of org.springframework.boot.actuate.health.HealthEndpointGroups in project spring-boot by spring-projects.

the class AvailabilityProbesHealthEndpointGroupsTests method getWhenProbeNotInDelegateReturnsProbeGroup.

@Test
void getWhenProbeNotInDelegateReturnsProbeGroup() {
    HealthEndpointGroups availabilityProbes = new AvailabilityProbesHealthEndpointGroups(this.delegate, false);
    assertThat(availabilityProbes.get("liveness")).isInstanceOf(AvailabilityProbesHealthEndpointGroup.class);
}
Also used : HealthEndpointGroups(org.springframework.boot.actuate.health.HealthEndpointGroups) Test(org.junit.jupiter.api.Test)

Example 24 with HealthEndpointGroups

use of org.springframework.boot.actuate.health.HealthEndpointGroups in project spring-boot by spring-projects.

the class AvailabilityProbesHealthEndpointGroupsTests method getPrimaryDelegatesToGroups.

@Test
void getPrimaryDelegatesToGroups() {
    given(this.delegate.getPrimary()).willReturn(this.group);
    HealthEndpointGroups availabilityProbes = new AvailabilityProbesHealthEndpointGroups(this.delegate, false);
    assertThat(availabilityProbes.getPrimary()).isEqualTo(this.group);
}
Also used : HealthEndpointGroups(org.springframework.boot.actuate.health.HealthEndpointGroups) Test(org.junit.jupiter.api.Test)

Example 25 with HealthEndpointGroups

use of org.springframework.boot.actuate.health.HealthEndpointGroups in project spring-boot by spring-projects.

the class AvailabilityProbesHealthEndpointGroupsTests method getNamesIncludesAvailabilityProbeGroups.

@Test
void getNamesIncludesAvailabilityProbeGroups() {
    given(this.delegate.getNames()).willReturn(Collections.singleton("test"));
    HealthEndpointGroups availabilityProbes = new AvailabilityProbesHealthEndpointGroups(this.delegate, false);
    assertThat(availabilityProbes.getNames()).containsExactly("test", "liveness", "readiness");
}
Also used : HealthEndpointGroups(org.springframework.boot.actuate.health.HealthEndpointGroups) Test(org.junit.jupiter.api.Test)

Aggregations

HealthEndpointGroups (org.springframework.boot.actuate.health.HealthEndpointGroups)35 Test (org.junit.jupiter.api.Test)34 HealthEndpointGroup (org.springframework.boot.actuate.health.HealthEndpointGroup)22 LinkedHashSet (java.util.LinkedHashSet)3 MockEnvironment (org.springframework.mock.env.MockEnvironment)1