use of io.fabric8.maven.docker.config.BuildImageConfiguration in project fabric8-maven-plugin by fabric8io.
the class PrometheusEnricherTest method testDetectPrometheusPort.
@Test
public void testDetectPrometheusPort() throws Exception {
final ProcessorConfig config = new ProcessorConfig(null, null, Collections.singletonMap(PrometheusEnricher.ENRICHER_NAME, new TreeMap()));
final BuildImageConfiguration imageConfig = new BuildImageConfiguration.Builder().ports(Arrays.asList(PrometheusEnricher.PROMETHEUS_PORT)).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);
assertEquals(2, annotations.size());
assertEquals("9779", annotations.get(Annotations.Management.PROMETHEUS_PORT));
assertEquals("true", annotations.get(Annotations.Management.PROMETHEUS_SCRAPE));
}
Aggregations