Search in sources :

Example 1 with GroupArtifactVersion

use of org.eclipse.jkube.kit.config.resource.GroupArtifactVersion in project jkube by eclipse.

the class MavenProjectEnricherTest method setupExpectations.

@Before
public void setupExpectations() {
    new Expectations() {

        {
            context.getGav();
            result = new GroupArtifactVersion("groupId", "artifactId", "version");
        }
    };
}
Also used : Expectations(mockit.Expectations) GroupArtifactVersion(org.eclipse.jkube.kit.config.resource.GroupArtifactVersion) Before(org.junit.Before)

Example 2 with GroupArtifactVersion

use of org.eclipse.jkube.kit.config.resource.GroupArtifactVersion in project jkube by eclipse.

the class KubernetesResourceUtilTest method extractContainerName.

@Test
public void extractContainerName() {
    // Given
    final ImageConfiguration imageConfiguration = ImageConfiguration.builder().name("dummy-image").registry("example.com/someregistry").name("test").build();
    // When
    final String result = KubernetesResourceUtil.extractContainerName(new GroupArtifactVersion("io.fabric8-test-", "fabric8-maven-plugin-dummy", "0"), imageConfiguration);
    // Then
    assertThat(result).isEqualTo("iofabric8-test--fabric8-maven-plugin-dummy");
}
Also used : ImageConfiguration(org.eclipse.jkube.kit.config.image.ImageConfiguration) GroupArtifactVersion(org.eclipse.jkube.kit.config.resource.GroupArtifactVersion) Test(org.junit.Test)

Example 3 with GroupArtifactVersion

use of org.eclipse.jkube.kit.config.resource.GroupArtifactVersion in project jkube by eclipse.

the class ContainerHandlerTest method imagePullPolicyWithPolicySetTest.

@Test
public void imagePullPolicyWithPolicySetTest() {
    // check if policy is set then both in case of version is not null or null
    // project with version and ending in SNAPSHOT
    project1.setVersion("3.5-SNAPSHOT");
    // project with version but not ending in SNAPSHOT
    project2.setVersion("3.5-NEW");
    // creating container Handler for all
    ContainerHandler handler1 = new ContainerHandler(project1.getProperties(), new GroupArtifactVersion("g", "a", "3.5-SNAPSHOT"), probeHandler);
    ContainerHandler handler2 = new ContainerHandler(project2.getProperties(), new GroupArtifactVersion("g", "a", "3.5-NEW"), probeHandler);
    images.clear();
    images.add(imageConfiguration1);
    containers = handler1.getContainers(config1, images);
    assertEquals("IfNotPresent", containers.get(0).getImagePullPolicy());
    containers = handler2.getContainers(config1, images);
    assertEquals("IfNotPresent", containers.get(0).getImagePullPolicy());
}
Also used : GroupArtifactVersion(org.eclipse.jkube.kit.config.resource.GroupArtifactVersion) Test(org.junit.Test)

Example 4 with GroupArtifactVersion

use of org.eclipse.jkube.kit.config.resource.GroupArtifactVersion in project jkube by eclipse.

the class DeploymentHandlerTest 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");
    VolumeConfig volumeConfig1 = VolumeConfig.builder().name("test").mounts(mounts).type("hostPath").path("/test/path").build();
    volumes1.add(volumeConfig1);
    // container name with alias
    final BuildConfiguration buildImageConfiguration = BuildConfiguration.builder().ports(ports).from("fabric8/maven:latest").cleanup("try").tags(tags).compressionString("gzip").build();
    ImageConfiguration imageConfiguration = ImageConfiguration.builder().name("test").alias("test-app").build(buildImageConfiguration).registry("docker.io").build();
    images.add(imageConfiguration);
    deploymentHandler = new DeploymentHandler(new PodTemplateHandler(new ContainerHandler(project.getProperties(), new GroupArtifactVersion("g", "a", "v"), probeHandler)));
}
Also used : BuildConfiguration(org.eclipse.jkube.kit.config.image.build.BuildConfiguration) ImageConfiguration(org.eclipse.jkube.kit.config.image.ImageConfiguration) GroupArtifactVersion(org.eclipse.jkube.kit.config.resource.GroupArtifactVersion) VolumeConfig(org.eclipse.jkube.kit.config.resource.VolumeConfig) Before(org.junit.Before)

Example 5 with GroupArtifactVersion

use of org.eclipse.jkube.kit.config.resource.GroupArtifactVersion in project jkube by eclipse.

the class KubernetesResourceUtilTest method extractContainerName_withPeriodsInImageUser_shouldRemovePeriodsFromContainerName.

@Test
public void extractContainerName_withPeriodsInImageUser_shouldRemovePeriodsFromContainerName() {
    // Given
    final ImageConfiguration imageConfiguration = ImageConfiguration.builder().name("org.eclipse.jkube.testing/test-image").build();
    final GroupArtifactVersion gav = new GroupArtifactVersion("org.eclipse.jkube.testing", "test-image", "1.0.0");
    // When
    final String result = KubernetesResourceUtil.extractContainerName(gav, imageConfiguration);
    // Then
    assertThat(result).isEqualTo("orgeclipsejkubetesting-test-image");
}
Also used : ImageConfiguration(org.eclipse.jkube.kit.config.image.ImageConfiguration) GroupArtifactVersion(org.eclipse.jkube.kit.config.resource.GroupArtifactVersion) Test(org.junit.Test)

Aggregations

GroupArtifactVersion (org.eclipse.jkube.kit.config.resource.GroupArtifactVersion)16 ImageConfiguration (org.eclipse.jkube.kit.config.image.ImageConfiguration)11 BuildConfiguration (org.eclipse.jkube.kit.config.image.build.BuildConfiguration)9 Before (org.junit.Before)8 Test (org.junit.Test)7 VolumeConfig (org.eclipse.jkube.kit.config.resource.VolumeConfig)6 Expectations (mockit.Expectations)2 HashMap (java.util.HashMap)1 Properties (java.util.Properties)1 ResourceConfig (org.eclipse.jkube.kit.config.resource.ResourceConfig)1