use of io.fabric8.insight.metrics.model.Result in project fabric8-maven-plugin by fabric8io.
the class VertxHealthCheckEnricherTest method testLivenessDisabledAndReadinessEnabled.
@Test
public void testLivenessDisabledAndReadinessEnabled() {
VertxHealthCheckEnricher enricher = new VertxHealthCheckEnricher(context);
final Properties props = new Properties();
props.put("vertx.health.readiness.path", "/ping");
props.put("vertx.health.path", "");
new Expectations() {
{
context.getProject().getProperties();
result = props;
}
};
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 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.insight.metrics.model.Result in project fabric8-maven-plugin by fabric8io.
the class MavenProjectEnricherTest method testOldStyleGeneratedResources.
@Test
public void testOldStyleGeneratedResources() {
final Properties properties = new Properties();
properties.setProperty("fabric8.enricher.fmp-project.useProjectLabel", "true");
new Expectations() {
{
mavenProject.getProperties();
result = properties;
}
};
ProjectEnricher projectEnricher = new ProjectEnricher(context);
KubernetesListBuilder builder = createListWithDeploymentConfig();
projectEnricher.adapt(builder);
KubernetesList list = builder.build();
Map<String, String> labels = list.getItems().get(0).getMetadata().getLabels();
assertNotNull(labels);
assertEquals("groupId", labels.get("group"));
assertEquals("artifactId", labels.get("project"));
assertEquals("version", labels.get("version"));
assertNull(labels.get("app"));
Map<String, String> selectors = projectEnricher.getSelector(Kind.DEPLOYMENT_CONFIG);
assertEquals("groupId", selectors.get("group"));
assertEquals("artifactId", selectors.get("project"));
assertNull(selectors.get("version"));
assertNull(selectors.get("app"));
}
use of io.fabric8.insight.metrics.model.Result in project fabric8-maven-plugin by fabric8io.
the class RevisionHistoryEnricherTest method testCustomRevisionHistoryLimit.
@Test
public void testCustomRevisionHistoryLimit() throws JsonProcessingException {
// Setup mock behaviour
final String revisionNumber = "10";
new Expectations() {
{
context.getConfig();
result = prepareEnricherConfig(revisionNumber);
}
};
// Given
KubernetesListBuilder builder = new KubernetesListBuilder().addNewDeploymentItem().endDeploymentItem();
RevisionHistoryEnricher enricher = new RevisionHistoryEnricher(context);
// When
enricher.addMissingResources(builder);
// Then
assertRevisionHistory(builder.build(), Integer.parseInt(revisionNumber));
}
use of io.fabric8.insight.metrics.model.Result 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