use of io.fabric8.kubernetes.api.model.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());
}
use of io.fabric8.kubernetes.api.model.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());
}
use of io.fabric8.kubernetes.api.model.Context in project fabric8-maven-plugin by fabric8io.
the class AbstractSpringBootHealthCheckEnricherSupport method testSchemeWithServerPortAndManagementPortAndServerKeystore.
@Test
public void testSchemeWithServerPortAndManagementPortAndServerKeystore() {
SpringBootHealthCheckEnricher enricher = new SpringBootHealthCheckEnricher(context);
Properties props = new Properties();
props.put(propertyHelper.getServerPortPropertyKey(), "8443");
props.put(propertyHelper.getManagementPortPropertyKey(), "8081");
props.put(propertyHelper.getServerKeystorePropertyKey(), "classpath:keystore.p12");
Probe probe = enricher.buildProbe(props, 10, null);
assertNotNull(probe);
assertNotNull(probe.getHttpGet());
assertEquals("HTTP", probe.getHttpGet().getScheme());
assertEquals(8081, probe.getHttpGet().getPort().getIntVal().intValue());
}
use of io.fabric8.kubernetes.api.model.Context in project fabric8-maven-plugin by fabric8io.
the class AbstractSpringBootHealthCheckEnricherSupport method testWithServerPortAndServerContextPathAndManagementContextPathAndServletPath.
@Test
public void testWithServerPortAndServerContextPathAndManagementContextPathAndServletPath() {
SpringBootHealthCheckEnricher enricher = new SpringBootHealthCheckEnricher(context);
Properties props = new Properties();
props.put(propertyHelper.getServerPortPropertyKey(), "8282");
props.put(propertyHelper.getServletPathPropertyKey(), "/servlet");
props.put(propertyHelper.getManagementContextPathPropertyKey(), "/p1");
props.put(propertyHelper.getServerContextPathPropertyKey(), "/p2");
Probe probe = enricher.buildProbe(props, 10, null);
assertNotNull(probe);
assertNotNull(probe.getHttpGet());
assertEquals("/p2/servlet/p1" + propertyHelper.getActuatorDefaultBasePath() + "/health", probe.getHttpGet().getPath());
assertEquals(8282, probe.getHttpGet().getPort().getIntVal().intValue());
}
use of io.fabric8.kubernetes.api.model.Context in project fabric8-maven-plugin by fabric8io.
the class DockerHealthCheckEnricherTest method testUnmatchingHealthCheck.
@Test
public void testUnmatchingHealthCheck() throws Exception {
// Setup mock behaviour
new Expectations() {
{
context.getImages();
result = Arrays.asList(new ImageConfiguration.Builder().alias("myImage").buildConfig(new BuildImageConfiguration.Builder().healthCheck(new HealthCheckConfiguration.Builder().mode(HealthCheckMode.cmd).cmd("/bin/check").timeout("1s").interval("1h1s").retries(3).build()).build()).build());
}
};
KubernetesListBuilder builder = createDeployment("myUnmatchingImage");
DockerHealthCheckEnricher enricher = new DockerHealthCheckEnricher(context);
enricher.addMissingResources(builder);
KubernetesList list = builder.build();
assertEquals(1, list.getItems().size());
assertNoProbes(list.getItems().get(0));
}
Aggregations