Search in sources :

Example 31 with BuildImageConfiguration

use of io.fabric8.maven.docker.config.BuildImageConfiguration in project docker-maven-plugin by fabric8io.

the class PropertyConfigHandlerTest method testRunCommands.

@Test
public void testRunCommands() {
    List<ImageConfiguration> configs = resolveImage(imageConfiguration, props("docker.from", "base", "docker.name", "demo", "docker.run.1", "foo", "docker.run.2", "bar", "docker.run.3", "wibble"));
    assertEquals(1, configs.size());
    BuildImageConfiguration buildConfig = configs.get(0).getBuildConfiguration();
    String[] runCommands = new ArrayList<>(buildConfig.getRunCmds()).toArray(new String[buildConfig.getRunCmds().size()]);
    assertArrayEquals(new String[] { "foo", "bar", "wibble" }, runCommands);
}
Also used : BuildImageConfiguration(io.fabric8.maven.docker.config.BuildImageConfiguration) BuildImageConfiguration(io.fabric8.maven.docker.config.BuildImageConfiguration) AbstractConfigHandlerTest(io.fabric8.maven.docker.config.handler.AbstractConfigHandlerTest)

Example 32 with BuildImageConfiguration

use of io.fabric8.maven.docker.config.BuildImageConfiguration in project fabric8-maven-plugin by fabric8io.

the class BaseGeneratorTest method addFromIstagModeWithoutSelector.

@Test
public void addFromIstagModeWithoutSelector() {
    Properties props = new Properties();
    props.put("fabric8.generator.fromMode", "istag");
    for (String from : new String[] { null, "test_namespace/test_image:2.0" }) {
        setupContext(props, false, from, null);
        BuildImageConfiguration.Builder builder = new BuildImageConfiguration.Builder();
        BaseGenerator generator = createGenerator(null);
        generator.addFrom(builder);
        BuildImageConfiguration config = builder.build();
        assertEquals(from == null ? null : "test_image:2.0", config.getFrom());
        Map<String, String> fromExt = config.getFromExt();
        if (from == null) {
            assertNull(fromExt);
        } else {
            assertFromExt(fromExt, "test_image:2.0", "test_namespace");
        }
    }
}
Also used : Properties(java.util.Properties) BuildImageConfiguration(io.fabric8.maven.docker.config.BuildImageConfiguration) Test(org.junit.Test)

Example 33 with BuildImageConfiguration

use of io.fabric8.maven.docker.config.BuildImageConfiguration in project fabric8-maven-plugin by fabric8io.

the class BaseGeneratorTest method addFromIstagWithNameWithoutTag.

@Test
public void addFromIstagWithNameWithoutTag() {
    Properties props = new Properties();
    setupContext(props, false, "test_namespace/test_image", "istag");
    BuildImageConfiguration.Builder builder = new BuildImageConfiguration.Builder();
    BaseGenerator generator = createGenerator(null);
    generator.addFrom(builder);
    BuildImageConfiguration config = builder.build();
    assertEquals("test_image:latest", config.getFrom());
}
Also used : Properties(java.util.Properties) BuildImageConfiguration(io.fabric8.maven.docker.config.BuildImageConfiguration) Test(org.junit.Test)

Example 34 with BuildImageConfiguration

use of io.fabric8.maven.docker.config.BuildImageConfiguration in project fabric8-maven-plugin by fabric8io.

the class BaseGeneratorTest method addFromIstagModeWithSelector.

@Test
public void addFromIstagModeWithSelector() {
    Properties props = new Properties();
    props.put("fabric8.generator.fromMode", "istag");
    for (String from : new String[] { null, "test_namespace/test_image:2.0" }) {
        setupContext(props, false, from, null);
        BuildImageConfiguration.Builder builder = new BuildImageConfiguration.Builder();
        BaseGenerator generator = createGenerator(new TestFromSelector(ctx, false));
        generator.addFrom(builder);
        BuildImageConfiguration config = builder.build();
        assertEquals(from == null ? "selectorIstagFromUpstream" : "test_image:2.0", config.getFrom());
        Map<String, String> fromExt = config.getFromExt();
        if (from != null) {
            assertFromExt(fromExt, "test_image:2.0", "test_namespace");
        } else {
            assertFromExt(fromExt, "selectorIstagFromUpstream", "openshift");
        }
    }
}
Also used : Properties(java.util.Properties) BuildImageConfiguration(io.fabric8.maven.docker.config.BuildImageConfiguration) Test(org.junit.Test)

Example 35 with BuildImageConfiguration

use of io.fabric8.maven.docker.config.BuildImageConfiguration in project fabric8-maven-plugin by fabric8io.

the class PodTemplateHandlerTest method before.

@Before
public void before() {
    // volume config with name and multiple mount
    mounts.add("/path/system");
    mounts.add("/path/sys");
    ports.add("8080");
    ports.add("9090");
    tags.add("latest");
    tags.add("test");
    // container name with alias
    BuildImageConfiguration buildImageConfiguration = new BuildImageConfiguration.Builder().ports(ports).from("fabric8/maven:latest").cleanup("try").tags(tags).compression("gzip").build();
    ImageConfiguration imageConfiguration = new ImageConfiguration.Builder().name("test").alias("test-app").buildConfig(buildImageConfiguration).registry("docker.io").build();
    images.add(imageConfiguration);
}
Also used : BuildImageConfiguration(io.fabric8.maven.docker.config.BuildImageConfiguration) ImageConfiguration(io.fabric8.maven.docker.config.ImageConfiguration) BuildImageConfiguration(io.fabric8.maven.docker.config.BuildImageConfiguration) Before(org.junit.Before)

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