Search in sources :

Example 21 with ImageConfiguration

use of org.eclipse.jkube.kit.config.image.ImageConfiguration in project jkube by eclipse.

the class PropertyConfigHandlerTest method testBuildFromDockerFileMerged.

@Test
public void testBuildFromDockerFileMerged() {
    imageConfiguration = ImageConfiguration.builder().name("myimage").external(externalMode(PropertyMode.Override)).build(BuildConfiguration.builder().dockerFile("/some/path").addCacheFrom("foo/bar:latest").build()).build();
    List<ImageConfiguration> configs = resolveImage(imageConfiguration, props());
    assertEquals(1, configs.size());
    BuildConfiguration buildConfiguration = configs.get(0).getBuildConfiguration();
    assertNotNull(buildConfiguration);
    buildConfiguration.initAndValidate();
    Path absolutePath = Paths.get(".").toAbsolutePath();
    String expectedPath = absolutePath.getRoot() + "some" + File.separator + "path";
    assertEquals(expectedPath, buildConfiguration.getDockerFile().getAbsolutePath());
}
Also used : BuildConfiguration(org.eclipse.jkube.kit.config.image.build.BuildConfiguration) Path(java.nio.file.Path) ImageConfiguration(org.eclipse.jkube.kit.config.image.ImageConfiguration) RunImageConfiguration(org.eclipse.jkube.kit.config.image.RunImageConfiguration) Test(org.junit.Test)

Example 22 with ImageConfiguration

use of org.eclipse.jkube.kit.config.image.ImageConfiguration in project jkube by eclipse.

the class PropertyConfigHandlerTest method testResolve.

@Test
public void testResolve() {
    ImageConfiguration resolved = resolveExternalImageConfig(mergeArrays(getBaseTestData(), getTestData()));
    validateBuildConfiguration(resolved.getBuildConfiguration());
    validateRunConfiguration(resolved.getRunConfiguration());
// validateWaitConfiguraion(resolved.getRunConfiguration().getWaitConfiguration());
}
Also used : ImageConfiguration(org.eclipse.jkube.kit.config.image.ImageConfiguration) RunImageConfiguration(org.eclipse.jkube.kit.config.image.RunImageConfiguration) Test(org.junit.Test)

Example 23 with ImageConfiguration

use of org.eclipse.jkube.kit.config.image.ImageConfiguration in project jkube by eclipse.

the class PropertyConfigHandlerTest method testDockerFile.

@Test
public void testDockerFile() {
    String[] testData = new String[] { k(ConfigKey.NAME), "image", k(ConfigKey.DOCKER_FILE), "file", "docker.args.foo", "bar" };
    ImageConfiguration config = resolveExternalImageConfig(mergeArrays(getBaseTestData(), testData));
    assertNotNull(config.getBuildConfiguration());
}
Also used : ImageConfiguration(org.eclipse.jkube.kit.config.image.ImageConfiguration) RunImageConfiguration(org.eclipse.jkube.kit.config.image.RunImageConfiguration) Test(org.junit.Test)

Example 24 with ImageConfiguration

use of org.eclipse.jkube.kit.config.image.ImageConfiguration in project jkube by eclipse.

the class PropertyConfigHandlerTest method testNoCleanup.

@Test
public void testNoCleanup() {
    String[] testData = new String[] { k(ConfigKey.NAME), "image", k(ConfigKey.CLEANUP), "none", k(ConfigKey.FROM), "base" };
    ImageConfiguration config = resolveExternalImageConfig(mergeArrays(getBaseTestData(), testData));
    assertEquals(CleanupMode.NONE, config.getBuildConfiguration().cleanupMode());
}
Also used : ImageConfiguration(org.eclipse.jkube.kit.config.image.ImageConfiguration) RunImageConfiguration(org.eclipse.jkube.kit.config.image.RunImageConfiguration) Test(org.junit.Test)

Example 25 with ImageConfiguration

use of org.eclipse.jkube.kit.config.image.ImageConfiguration in project jkube by eclipse.

the class PropertyConfigHandlerTest method testRunCommands.

@Test
public void testRunCommands() {
    List<ImageConfiguration> configs = resolveImage(imageConfiguration, props(mergeArrays(getBaseTestData(), new String[] { "docker.from", "base", "docker.name", "demo", "docker.run.1", "foo", "docker.run.2", "bar", "docker.run.3", "wibble" })));
    assertEquals(1, configs.size());
    BuildConfiguration buildConfig = configs.get(0).getBuildConfiguration();
    String[] runCommands = new ArrayList<>(buildConfig.getRunCmds()).toArray(new String[buildConfig.getRunCmds().size()]);
    assertArrayEquals(new String[] { "xyz", "foo", "bar", "wibble" }, runCommands);
}
Also used : BuildConfiguration(org.eclipse.jkube.kit.config.image.build.BuildConfiguration) ImageConfiguration(org.eclipse.jkube.kit.config.image.ImageConfiguration) RunImageConfiguration(org.eclipse.jkube.kit.config.image.RunImageConfiguration) Test(org.junit.Test)

Aggregations

ImageConfiguration (org.eclipse.jkube.kit.config.image.ImageConfiguration)109 Test (org.junit.Test)75 BuildConfiguration (org.eclipse.jkube.kit.config.image.build.BuildConfiguration)29 RunImageConfiguration (org.eclipse.jkube.kit.config.image.RunImageConfiguration)28 File (java.io.File)26 ArrayList (java.util.ArrayList)19 Expectations (mockit.Expectations)15 GroupArtifactVersion (org.eclipse.jkube.kit.config.resource.GroupArtifactVersion)11 Before (org.junit.Before)11 IOException (java.io.IOException)9 Properties (java.util.Properties)8 KitLogger (org.eclipse.jkube.kit.common.KitLogger)8 KubernetesListBuilder (io.fabric8.kubernetes.api.model.KubernetesListBuilder)7 JKubeServiceException (org.eclipse.jkube.kit.config.service.JKubeServiceException)7 WatchImageConfiguration (org.eclipse.jkube.kit.config.image.WatchImageConfiguration)6 ResourceConfig (org.eclipse.jkube.kit.config.resource.ResourceConfig)6 List (java.util.List)5 JKubeConfiguration (org.eclipse.jkube.kit.common.JKubeConfiguration)5 VolumeConfig (org.eclipse.jkube.kit.config.resource.VolumeConfig)5 Container (io.fabric8.kubernetes.api.model.Container)4