use of io.fabric8.core.jmx.HealthCheck in project docker-maven-plugin by fabric8io.
the class DockerFileBuilderTest method testHealthCheckCmdParams.
@Test
public void testHealthCheckCmdParams() {
HealthCheckConfiguration hc = new HealthCheckConfiguration.Builder().cmd("echo hello").interval("5s").timeout("3s").retries(4).build();
String dockerfileContent = new DockerFileBuilder().healthCheck(hc).content();
assertThat(dockerfileToMap(dockerfileContent), hasEntry("HEALTHCHECK", "--interval=5s --timeout=3s --retries=4 CMD echo hello"));
}
use of io.fabric8.core.jmx.HealthCheck in project fabric8 by jboss-fuse.
the class FabricMBeanRegistrationListener method registerFabricMBeans.
private void registerFabricMBeans() {
this.healthCheck = new HealthCheck(fabricService.get());
this.managerMBean = new FabricManager((FabricServiceImpl) fabricService.get());
this.zooKeeperMBean = new ZooKeeperFacade((FabricServiceImpl) fabricService.get());
this.fileSystemMBean = new FileSystem(runtimeProperties.get());
healthCheck.registerMBeanServer(shutdownTracker, mbeanServer.get());
managerMBean.registerMBeanServer(shutdownTracker, mbeanServer.get());
fileSystemMBean.registerMBeanServer(shutdownTracker, mbeanServer.get());
zooKeeperMBean.registerMBeanServer(shutdownTracker, mbeanServer.get());
}
use of io.fabric8.core.jmx.HealthCheck in project strimzi by strimzi.
the class OpenShiftTemplatesTest method testStrimziEphemeralWithCustomParameters.
@Test
public void testStrimziEphemeralWithCustomParameters() {
String clusterName = "test-ephemeral-with-custom-parameters";
oc.newApp("strimzi-ephemeral", map("CLUSTER_NAME", clusterName, "ZOOKEEPER_HEALTHCHECK_DELAY", "30", "ZOOKEEPER_HEALTHCHECK_TIMEOUT", "10", "KAFKA_HEALTHCHECK_DELAY", "30", "KAFKA_HEALTHCHECK_TIMEOUT", "10", "KAFKA_DEFAULT_REPLICATION_FACTOR", "2", "KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR", "5", "KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR", "5"));
// TODO Add assertions to check that Kafka brokers have a custom configuration
ConfigMap cm = client.configMaps().inNamespace(NAMESPACE).withName(clusterName).get();
assertNotNull(cm);
Map<String, String> cmData = cm.getData();
assertEquals("30", cmData.get("zookeeper-healthcheck-delay"));
assertEquals("10", cmData.get("zookeeper-healthcheck-timeout"));
assertEquals("30", cmData.get("kafka-healthcheck-delay"));
assertEquals("10", cmData.get("kafka-healthcheck-timeout"));
assertEquals("2", cmData.get("KAFKA_DEFAULT_REPLICATION_FACTOR"));
assertEquals("5", cmData.get("KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR"));
assertEquals("5", cmData.get("KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR"));
}
use of io.fabric8.core.jmx.HealthCheck in project fabric8-maven-plugin by fabric8io.
the class DockerHealthCheckEnricherTest method testEnrichFromDoubleImage.
@Test
public void testEnrichFromDoubleImage() 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(), new ImageConfiguration.Builder().alias("myImage2").buildConfig(new BuildImageConfiguration.Builder().healthCheck(new HealthCheckConfiguration.Builder().mode(HealthCheckMode.cmd).cmd("/xxx/check").timeout("3s").interval("3h1s").retries(9).build()).build()).build());
}
};
KubernetesListBuilder builder = addDeployment(createDeployment("myImage"), "myImage2");
DockerHealthCheckEnricher enricher = new DockerHealthCheckEnricher(context);
enricher.addMissingResources(builder);
KubernetesList list = builder.build();
assertEquals(2, list.getItems().size());
assertHealthCheckMatching(builder.build().getItems().get(0), "livenessProbe", "/bin/check", 1, 3601, 3);
assertHealthCheckMatching(builder.build().getItems().get(0), "readinessProbe", "/bin/check", 1, 3601, 3);
assertHealthCheckMatching(builder.build().getItems().get(1), "livenessProbe", "/xxx/check", 3, 10801, 9);
assertHealthCheckMatching(builder.build().getItems().get(1), "readinessProbe", "/xxx/check", 3, 10801, 9);
}
use of io.fabric8.core.jmx.HealthCheck in project fabric8-maven-plugin by fabric8io.
the class DockerHealthCheckEnricherTest method testInvalidHealthCheck.
@Test
public void testInvalidHealthCheck() 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.none).build()).build()).build());
}
};
KubernetesListBuilder builder = createDeployment("myImage");
DockerHealthCheckEnricher enricher = new DockerHealthCheckEnricher(context);
enricher.addMissingResources(builder);
KubernetesList list = builder.build();
assertEquals(1, list.getItems().size());
assertNoProbes(list.getItems().get(0));
}
Aggregations