Search in sources :

Example 36 with Context

use of io.fabric8.mockwebserver.Context in project fabric8-maven-plugin by fabric8io.

the class AbstractSpringBootHealthCheckEnricherSupport method testWithServerPortAndManagementContextPath.

@Test
public void testWithServerPortAndManagementContextPath() {
    SpringBootHealthCheckEnricher enricher = new SpringBootHealthCheckEnricher(context);
    Properties props = new Properties();
    props.put(propertyHelper.getServerPortPropertyKey(), "8282");
    props.put(propertyHelper.getManagementContextPathPropertyKey(), "/p1");
    Probe probe = enricher.buildProbe(props, 10, null);
    assertNotNull(probe);
    assertNotNull(probe.getHttpGet());
    assertEquals("/p1" + propertyHelper.getActuatorDefaultBasePath() + "/health", probe.getHttpGet().getPath());
    assertEquals(8282, probe.getHttpGet().getPort().getIntVal().intValue());
}
Also used : Probe(io.fabric8.kubernetes.api.model.Probe) Test(org.junit.Test)

Example 37 with Context

use of io.fabric8.mockwebserver.Context in project fabric8-maven-plugin by fabric8io.

the class AbstractSpringBootHealthCheckEnricherSupport method testWithServerPort.

@Test
public void testWithServerPort() {
    SpringBootHealthCheckEnricher enricher = new SpringBootHealthCheckEnricher(context);
    Properties props = new Properties();
    props.put(propertyHelper.getServerPortPropertyKey(), "8282");
    Probe probe = enricher.buildProbe(props, 10, null);
    assertNotNull(probe);
    assertNotNull(probe.getHttpGet());
    assertEquals(propertyHelper.getActuatorDefaultBasePath() + "/health", probe.getHttpGet().getPath());
    assertEquals(8282, probe.getHttpGet().getPort().getIntVal().intValue());
}
Also used : Probe(io.fabric8.kubernetes.api.model.Probe) Test(org.junit.Test)

Example 38 with Context

use of io.fabric8.mockwebserver.Context in project fabric8-maven-plugin by fabric8io.

the class AbstractSpringBootHealthCheckEnricherSupport method testSchemeWithServerPort.

@Test
public void testSchemeWithServerPort() {
    SpringBootHealthCheckEnricher enricher = new SpringBootHealthCheckEnricher(context);
    Properties props = new Properties();
    props.put(propertyHelper.getServerPortPropertyKey(), "8443");
    Probe probe = enricher.buildProbe(props, 10, null);
    assertNotNull(probe);
    assertNotNull(probe.getHttpGet());
    assertEquals("HTTP", probe.getHttpGet().getScheme());
    assertEquals(8443, probe.getHttpGet().getPort().getIntVal().intValue());
}
Also used : Probe(io.fabric8.kubernetes.api.model.Probe) Test(org.junit.Test)

Example 39 with Context

use of io.fabric8.mockwebserver.Context in project fabric8-maven-plugin by fabric8io.

the class AbstractSpringBootHealthCheckEnricherSupport method testDefaultInitialDelayForLivenessAndReadiness.

@Test
public void testDefaultInitialDelayForLivenessAndReadiness() {
    SpringBootHealthCheckEnricher enricher = new SpringBootHealthCheckEnricher(context);
    withAllRequiredClasses();
    withProjectProperties(new Properties());
    Probe probe = enricher.getReadinessProbe();
    assertNotNull(probe);
    assertEquals(10, probe.getInitialDelaySeconds().intValue());
    probe = enricher.getLivenessProbe();
    assertNotNull(probe);
    assertEquals(180, probe.getInitialDelaySeconds().intValue());
}
Also used : Probe(io.fabric8.kubernetes.api.model.Probe) Test(org.junit.Test)

Example 40 with Context

use of io.fabric8.mockwebserver.Context in project fabric8-maven-plugin by fabric8io.

the class AbstractSpringBootHealthCheckEnricherSupport method testSchemeWithServerPortAndManagementKeystore.

@Test
public void testSchemeWithServerPortAndManagementKeystore() {
    SpringBootHealthCheckEnricher enricher = new SpringBootHealthCheckEnricher(context);
    Properties props = new Properties();
    props.put(propertyHelper.getServerPortPropertyKey(), "8080");
    props.put(propertyHelper.getManagementKeystorePropertyKey(), "classpath:keystore.p12");
    Probe probe = enricher.buildProbe(props, 10, null);
    assertNotNull(probe);
    assertNotNull(probe.getHttpGet());
    assertEquals("HTTP", probe.getHttpGet().getScheme());
    assertEquals(8080, probe.getHttpGet().getPort().getIntVal().intValue());
}
Also used : Probe(io.fabric8.kubernetes.api.model.Probe) Test(org.junit.Test)

Aggregations

Test (org.junit.jupiter.api.Test)593 Checkpoint (io.vertx.junit5.Checkpoint)574 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)543 VertxTestContext (io.vertx.junit5.VertxTestContext)542 Vertx (io.vertx.core.Vertx)539 Reconciliation (io.strimzi.operator.common.Reconciliation)532 VertxExtension (io.vertx.junit5.VertxExtension)514 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)514 BeforeAll (org.junit.jupiter.api.BeforeAll)466 AfterAll (org.junit.jupiter.api.AfterAll)462 CoreMatchers.is (org.hamcrest.CoreMatchers.is)458 Future (io.vertx.core.Future)429 Mockito.when (org.mockito.Mockito.when)410 KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)379 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)368 PlatformFeaturesAvailability (io.strimzi.operator.PlatformFeaturesAvailability)360 ArgumentMatchers.eq (org.mockito.ArgumentMatchers.eq)356 ResourceOperatorSupplier (io.strimzi.operator.cluster.operator.resource.ResourceOperatorSupplier)352 List (java.util.List)352 KubernetesVersion (io.strimzi.operator.KubernetesVersion)344