use of io.fabric8.maven.core.config.ProcessorConfig in project fabric8-maven-plugin by fabric8io.
the class AbstractSpringBootHealthCheckEnricherSupport method testCustomPropertiesForLivenessAndReadiness.
@Test
public void testCustomPropertiesForLivenessAndReadiness() {
Map<String, TreeMap> globalConfig = new HashMap<>();
TreeMap<String, String> enricherConfig = new TreeMap<>();
globalConfig.put(SpringBootHealthCheckEnricher.ENRICHER_NAME, enricherConfig);
enricherConfig.put("readinessProbeInitialDelaySeconds", "30");
enricherConfig.put("readinessProbePeriodSeconds", "40");
enricherConfig.put("livenessProbeInitialDelaySeconds", "460");
enricherConfig.put("livenessProbePeriodSeconds", "50");
final ProcessorConfig config = new ProcessorConfig(null, null, globalConfig);
new Expectations() {
{
context.getConfig();
result = config;
}
};
withAllRequiredClasses();
withProjectProperties(new Properties());
SpringBootHealthCheckEnricher enricher = new SpringBootHealthCheckEnricher(context);
Probe probe = enricher.getReadinessProbe();
assertNotNull(probe);
assertEquals(30, probe.getInitialDelaySeconds().intValue());
assertEquals(40, probe.getPeriodSeconds().intValue());
probe = enricher.getLivenessProbe();
assertNotNull(probe);
assertEquals(460, probe.getInitialDelaySeconds().intValue());
assertEquals(50, probe.getPeriodSeconds().intValue());
}
use of io.fabric8.maven.core.config.ProcessorConfig in project fabric8-maven-plugin by fabric8io.
the class AbstractSpringBootHealthCheckEnricherSupport method testCustomInitialDelayForLivenessAndReadiness.
@Test
public void testCustomInitialDelayForLivenessAndReadiness() {
Map<String, TreeMap> globalConfig = new HashMap<>();
TreeMap<String, String> enricherConfig = new TreeMap<>();
globalConfig.put(SpringBootHealthCheckEnricher.ENRICHER_NAME, enricherConfig);
enricherConfig.put("readinessProbeInitialDelaySeconds", "20");
enricherConfig.put("livenessProbeInitialDelaySeconds", "360");
final ProcessorConfig config = new ProcessorConfig(null, null, globalConfig);
new Expectations() {
{
context.getConfig();
result = config;
}
};
withAllRequiredClasses();
withProjectProperties(new Properties());
SpringBootHealthCheckEnricher enricher = new SpringBootHealthCheckEnricher(context);
Probe probe = enricher.getReadinessProbe();
assertNotNull(probe);
assertEquals(20, probe.getInitialDelaySeconds().intValue());
assertNull(probe.getPeriodSeconds());
probe = enricher.getLivenessProbe();
assertNotNull(probe);
assertEquals(360, probe.getInitialDelaySeconds().intValue());
assertNull(probe.getPeriodSeconds());
}
use of io.fabric8.maven.core.config.ProcessorConfig 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.maven.core.config.ProcessorConfig in project fabric8-maven-plugin by fabric8io.
the class DefaultControllerEnricherTest method setupExpectations.
protected void setupExpectations(final BuildImageConfiguration buildConfig, final TreeMap controllerConfig) {
new Expectations() {
{
project.getArtifactId();
result = "fmp-controller-test";
project.getBuild().getOutputDirectory();
result = Files.createTempDir().getAbsolutePath();
context.getProject();
result = project;
context.getConfig();
result = new ProcessorConfig(null, null, Collections.singletonMap("fmp-controller", controllerConfig));
imageConfiguration.getBuildConfiguration();
result = buildConfig;
imageConfiguration.getName();
result = "helloworld";
context.getImages();
result = Arrays.asList(imageConfiguration);
}
};
}
use of io.fabric8.maven.core.config.ProcessorConfig in project fabric8-maven-plugin by fabric8io.
the class PrometheusEnricherTest method testNoDefinedPrometheusPort.
@Test
public void testNoDefinedPrometheusPort() throws Exception {
final ProcessorConfig config = new ProcessorConfig(null, null, Collections.singletonMap(PrometheusEnricher.ENRICHER_NAME, new TreeMap()));
final BuildImageConfiguration imageConfig = new BuildImageConfiguration.Builder().build();
// Setup mock behaviour
new Expectations() {
{
context.getConfig();
result = config;
imageConfiguration.getBuildConfiguration();
result = imageConfig;
context.getImages();
result = Arrays.asList(imageConfiguration);
}
};
PrometheusEnricher enricher = new PrometheusEnricher(context);
Map<String, String> annotations = enricher.getAnnotations(Kind.SERVICE);
assertNull(annotations);
}
Aggregations