Search in sources :

Example 1 with BuildConfiguration

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

the class AssemblyManagerTest method testCopyValidVerifyGivenDockerfile.

@Test
public void testCopyValidVerifyGivenDockerfile(@Injectable final KitLogger logger) throws IOException {
    BuildConfiguration buildConfig = createBuildConfig();
    AssemblyManager.verifyAssemblyReferencedInDockerfile(new File(getClass().getResource("/docker/Dockerfile_assembly_verify_copy_valid.test").getPath()), buildConfig, new Properties(), logger);
    // @formatter:off
    new Verifications() {

        {
            logger.warn(anyString, (Object[]) any);
            times = 0;
        }
    };
// @formatter:on
}
Also used : BuildConfiguration(org.eclipse.jkube.kit.config.image.build.BuildConfiguration) Properties(java.util.Properties) Verifications(mockit.Verifications) File(java.io.File) Test(org.junit.Test)

Example 2 with BuildConfiguration

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

the class BuildUtilTest method extractBaseFromConfiguration_withEmptyBuildConfiguration_shouldReturnData.

@Test
public void extractBaseFromConfiguration_withEmptyBuildConfiguration_shouldReturnData() {
    // When
    final String result = extractBaseFromConfiguration(new BuildConfiguration());
    // Then
    assertThat(result).isEqualTo("busybox:latest");
}
Also used : BuildConfiguration(org.eclipse.jkube.kit.config.image.build.BuildConfiguration) Test(org.junit.Test)

Example 3 with BuildConfiguration

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

the class BuildUtilTest method extractBaseFromDockerfile_withNonExistentDockerfile_shouldReturnNull.

@Test
public void extractBaseFromDockerfile_withNonExistentDockerfile_shouldReturnNull() {
    // Given
    final JKubeConfiguration jKubeConfiguration = JKubeConfiguration.builder().sourceDirectory("src").project(JavaProject.builder().baseDirectory(new File(".")).build()).build();
    final BuildConfiguration buildConfiguration = BuildConfiguration.builder().dockerFileFile(new File("Dockerfile")).build();
    // When
    final String result = extractBaseFromDockerfile(jKubeConfiguration, buildConfiguration);
    // Then
    assertThat(result).isNull();
}
Also used : BuildConfiguration(org.eclipse.jkube.kit.config.image.build.BuildConfiguration) JKubeConfiguration(org.eclipse.jkube.kit.common.JKubeConfiguration) File(java.io.File) Test(org.junit.Test)

Example 4 with BuildConfiguration

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

the class BuildUtilTest method extractBaseFromConfiguration_withBuildConfigurationAssemblyAndFrom_shouldReturnFrom.

@Test
public void extractBaseFromConfiguration_withBuildConfigurationAssemblyAndFrom_shouldReturnFrom() {
    // Given
    final BuildConfiguration buildConfiguration = BuildConfiguration.builder().from("alpine:latest").assembly(new AssemblyConfiguration()).build();
    // When
    final String result = extractBaseFromConfiguration(buildConfiguration);
    // Then
    assertThat(result).isEqualTo("alpine:latest");
}
Also used : BuildConfiguration(org.eclipse.jkube.kit.config.image.build.BuildConfiguration) AssemblyConfiguration(org.eclipse.jkube.kit.common.AssemblyConfiguration) Test(org.junit.Test)

Example 5 with BuildConfiguration

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

the class AssemblyConfigurationUtilsTest method createDockerFileBuilder_withEmptyBuildConfigurationNoAssembly_shouldReturnOnlyBase.

@Test
public void createDockerFileBuilder_withEmptyBuildConfigurationNoAssembly_shouldReturnOnlyBase() {
    // Given
    final BuildConfiguration buildConfig = BuildConfiguration.builder().build();
    // When
    final String result = createDockerFileBuilder(buildConfig, null, null).content();
    // Then
    assertThat(result).doesNotContain("COPY", "VOLUME").isEqualTo("FROM busybox\n");
}
Also used : BuildConfiguration(org.eclipse.jkube.kit.config.image.build.BuildConfiguration) Test(org.junit.Test)

Aggregations

BuildConfiguration (org.eclipse.jkube.kit.config.image.build.BuildConfiguration)58 Test (org.junit.Test)39 ImageConfiguration (org.eclipse.jkube.kit.config.image.ImageConfiguration)24 File (java.io.File)23 Properties (java.util.Properties)11 AssemblyFile (org.eclipse.jkube.kit.common.AssemblyFile)10 JKubeConfiguration (org.eclipse.jkube.kit.common.JKubeConfiguration)10 RunImageConfiguration (org.eclipse.jkube.kit.config.image.RunImageConfiguration)8 GroupArtifactVersion (org.eclipse.jkube.kit.config.resource.GroupArtifactVersion)8 Before (org.junit.Before)8 AssemblyConfiguration (org.eclipse.jkube.kit.common.AssemblyConfiguration)7 ArrayList (java.util.ArrayList)6 Expectations (mockit.Expectations)5 VolumeConfig (org.eclipse.jkube.kit.config.resource.VolumeConfig)5 Verifications (mockit.Verifications)4 List (java.util.List)3 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)3 Assembly (org.eclipse.jkube.kit.common.Assembly)3 AssemblyFileEntry (org.eclipse.jkube.kit.common.AssemblyFileEntry)3 JavaProject (org.eclipse.jkube.kit.common.JavaProject)3