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());
}
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());
}
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());
}
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());
}
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);
}
Aggregations