Search in sources :

Example 41 with BuildImageConfiguration

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));
}
Also used : Expectations(mockit.Expectations) TreeMap(java.util.TreeMap) ProcessorConfig(io.fabric8.maven.core.config.ProcessorConfig) BuildImageConfiguration(io.fabric8.maven.docker.config.BuildImageConfiguration) Test(org.junit.Test)

Aggregations

BuildImageConfiguration (io.fabric8.maven.docker.config.BuildImageConfiguration)36 Test (org.junit.Test)16 ImageConfiguration (io.fabric8.maven.docker.config.ImageConfiguration)15 Before (org.junit.Before)7 VolumeConfig (io.fabric8.maven.core.config.VolumeConfig)6 File (java.io.File)6 AssemblyConfiguration (io.fabric8.maven.docker.config.AssemblyConfiguration)5 AbstractConfigHandlerTest (io.fabric8.maven.docker.config.handler.AbstractConfigHandlerTest)5 Expectations (mockit.Expectations)5 Properties (java.util.Properties)4 ProcessorConfig (io.fabric8.maven.core.config.ProcessorConfig)3 ArrayList (java.util.ArrayList)3 TreeMap (java.util.TreeMap)3 Verifications (mockit.Verifications)3 ContainerPort (io.fabric8.kubernetes.api.model.ContainerPort)1 KubernetesList (io.fabric8.kubernetes.api.model.KubernetesList)1 KubernetesListBuilder (io.fabric8.kubernetes.api.model.KubernetesListBuilder)1 AuthConfig (io.fabric8.maven.docker.access.AuthConfig)1 BuildOptions (io.fabric8.maven.docker.access.BuildOptions)1 DockerAccessException (io.fabric8.maven.docker.access.DockerAccessException)1