use of io.fabric8.insight.metrics.model.Result in project fabric8-maven-plugin by fabric8io.
the class VertxHealthCheckEnricherTest method testCustomConfiguration.
@Test
public void testCustomConfiguration() {
VertxHealthCheckEnricher enricher = new VertxHealthCheckEnricher(context);
final Properties props = new Properties();
props.put("vertx.health.path", "/health");
props.put("vertx.health.port", " 8081 ");
props.put("vertx.health.scheme", " https");
new Expectations() {
{
context.getProject().getProperties();
result = props;
}
};
Probe probe = enricher.getLivenessProbe();
assertNotNull(probe);
assertNull(probe.getHttpGet().getHost());
assertEquals(probe.getHttpGet().getScheme(), "https");
assertEquals(probe.getHttpGet().getPort().getIntVal().intValue(), 8081);
assertEquals(probe.getHttpGet().getPath(), "/health");
probe = enricher.getReadinessProbe();
assertNotNull(probe);
assertEquals(probe.getHttpGet().getScheme(), "https");
assertNull(probe.getHttpGet().getHost());
assertEquals(probe.getHttpGet().getPort().getIntVal().intValue(), 8081);
assertEquals(probe.getHttpGet().getPath(), "/health");
}
use of io.fabric8.insight.metrics.model.Result in project fabric8-maven-plugin by fabric8io.
the class VertxHealthCheckEnricherTest method testLivenessDisabledAndReadinessEnabledUsingConfig.
@Test
public void testLivenessDisabledAndReadinessEnabledUsingConfig() {
final ProcessorConfig config = new ProcessorConfig(null, null, Collections.singletonMap("vertx-health-check", new TreeMap(ImmutableMap.of(VertxHealthCheckEnricher.Config.readiness.name(), "/ping", VertxHealthCheckEnricher.Config.path.name(), ""))));
new Expectations() {
{
context.getConfig();
result = config;
}
};
VertxHealthCheckEnricher enricher = new VertxHealthCheckEnricher(context);
Probe probe = enricher.getLivenessProbe();
assertNull(probe);
probe = enricher.getReadinessProbe();
assertNotNull(probe);
assertEquals(probe.getHttpGet().getPath(), "/ping");
}
use of io.fabric8.insight.metrics.model.Result in project fabric8-maven-plugin by fabric8io.
the class VertxHealthCheckEnricherTest method testDifferentPathForLivenessAndReadiness.
@Test
public void testDifferentPathForLivenessAndReadiness() {
VertxHealthCheckEnricher enricher = new VertxHealthCheckEnricher(context);
final Properties props = new Properties();
props.put("vertx.health.path", "/ping");
props.put("vertx.health.readiness.path", "/ready");
new Expectations() {
{
context.getProject().getProperties();
result = props;
}
};
Probe probe = enricher.getLivenessProbe();
assertNotNull(probe);
assertNull(probe.getHttpGet().getHost());
assertEquals(probe.getHttpGet().getScheme(), "HTTP");
assertEquals(probe.getHttpGet().getPort().getIntVal().intValue(), 8080);
assertEquals(probe.getHttpGet().getPath(), "/ping");
probe = enricher.getReadinessProbe();
assertNotNull(probe);
assertEquals(probe.getHttpGet().getScheme(), "HTTP");
assertNull(probe.getHttpGet().getHost());
assertEquals(probe.getHttpGet().getPort().getIntVal().intValue(), 8080);
assertEquals(probe.getHttpGet().getPath(), "/ready");
}
use of io.fabric8.insight.metrics.model.Result in project fabric8-maven-plugin by fabric8io.
the class VertxHealthCheckEnricherTest method testDisabledUsingInvalidPort.
@Test
public void testDisabledUsingInvalidPort() {
VertxHealthCheckEnricher enricher = new VertxHealthCheckEnricher(context);
final Properties props = new Properties();
props.put("vertx.health.port", " none ");
props.put("vertx.health.path", " /ping ");
new Expectations() {
{
context.getProject().getProperties();
result = props;
}
};
Probe probe = enricher.getLivenessProbe();
assertNull(probe);
probe = enricher.getReadinessProbe();
assertNull(probe);
}
use of io.fabric8.insight.metrics.model.Result in project fabric8-maven-plugin by fabric8io.
the class VertxHealthCheckEnricherTest method testDisabledUsingEmptyPath.
@Test
public void testDisabledUsingEmptyPath() {
VertxHealthCheckEnricher enricher = new VertxHealthCheckEnricher(context);
final Properties props = new Properties();
props.put("vertx.health.path", "");
new Expectations() {
{
context.getProject().getProperties();
result = props;
}
};
Probe probe = enricher.getLivenessProbe();
assertNull(probe);
probe = enricher.getReadinessProbe();
assertNull(probe);
}
Aggregations