use of io.fabric8.openshift.api.model.Project in project fabric8-maven-plugin by fabric8io.
the class StatefulSetHandlerTest method statefulSetHandlerWithoutControllerTest.
@Test(expected = IllegalArgumentException.class)
public void statefulSetHandlerWithoutControllerTest() {
// without controller name
ContainerHandler containerHandler = new ContainerHandler(project, envVarHandler, probeHandler);
PodTemplateHandler podTemplateHandler = new PodTemplateHandler(containerHandler);
StatefulSetHandler statefulSetHandler = new StatefulSetHandler(podTemplateHandler);
// without controller name
ResourceConfig config = new ResourceConfig.Builder().imagePullPolicy("IfNotPresent").withServiceAccount("test-account").withReplicas(5).volumes(volumes1).build();
statefulSetHandler.getStatefulSet(config, images);
}
use of io.fabric8.openshift.api.model.Project in project fabric8-maven-plugin by fabric8io.
the class ContainerHandlerTest method containerPortsWithoutPortTest.
@Test
public void containerPortsWithoutPortTest() {
ContainerHandler handler = new ContainerHandler(project, envVarHandler, probeHandler);
// without Ports
BuildImageConfiguration buildImageConfiguration2 = new BuildImageConfiguration.Builder().from("fabric8/maven:latest").cleanup("try").compression("gzip").build();
ImageConfiguration imageConfiguration2 = new ImageConfiguration.Builder().name("test").alias("test-app").buildConfig(buildImageConfiguration2).registry("docker.io").build();
images.clear();
images.add(imageConfiguration2);
containers = handler.getContainers(config, images);
assertTrue(containers.get(0).getPorts().isEmpty());
}
use of io.fabric8.openshift.api.model.Project in project fabric8-maven-plugin by fabric8io.
the class ContainerHandlerTest method getContainerWithGroupArtifactTest.
@Test
public void getContainerWithGroupArtifactTest() {
project.setArtifactId("test-artifact");
project.setGroupId("test-group");
ports.add("8080");
ports.add("9090");
tags.add("latest");
tags.add("test");
ContainerHandler handler = new ContainerHandler(project, envVarHandler, probeHandler);
// container name with group id and aritact id without alias and user
BuildImageConfiguration buildImageConfiguration = new BuildImageConfiguration.Builder().ports(ports).from("fabric8/").cleanup("try").tags(tags).compression("gzip").dockerFile("testFile").dockerFileDir("/demo").build();
ImageConfiguration imageConfiguration = new ImageConfiguration.Builder().name("test").buildConfig(buildImageConfiguration).registry("docker.io").build();
images.clear();
images.add(imageConfiguration);
containers = handler.getContainers(config, images);
assertNotNull(containers);
assertEquals("test-group-test-artifact", containers.get(0).getName());
assertEquals("docker.io/test", containers.get(0).getImage());
assertEquals("IfNotPresent", containers.get(0).getImagePullPolicy());
}
use of io.fabric8.openshift.api.model.Project in project fabric8-maven-plugin by fabric8io.
the class ContainerHandlerTest method getVolumeMountWithNameAndMountTest.
@Test
public void getVolumeMountWithNameAndMountTest() {
ContainerHandler handler = new ContainerHandler(project, envVarHandler, probeHandler);
List<String> mounts = new ArrayList<>();
mounts.add("/path/etc");
images.clear();
images.add(imageConfiguration1);
// volume config with name and single mount
VolumeConfig volumeConfig3 = new VolumeConfig.Builder().name("third").mounts(mounts).build();
volumes1.clear();
volumes1.add(volumeConfig3);
ResourceConfig config3 = new ResourceConfig.Builder().volumes(volumes1).build();
containers = handler.getContainers(config3, images);
assertEquals(1, containers.get(0).getVolumeMounts().size());
assertEquals("third", containers.get(0).getVolumeMounts().get(0).getName());
assertEquals("/path/etc", containers.get(0).getVolumeMounts().get(0).getMountPath());
}
use of io.fabric8.openshift.api.model.Project in project fabric8-maven-plugin by fabric8io.
the class ContainerHandlerTest method getVolumeMountWithEmptyVolumeTest.
@Test
public void getVolumeMountWithEmptyVolumeTest() {
ContainerHandler handler = new ContainerHandler(project, envVarHandler, probeHandler);
images.clear();
images.add(imageConfiguration1);
// empty volume
ResourceConfig config5 = new ResourceConfig.Builder().volumes(volumes2).build();
containers = handler.getContainers(config5, images);
assertTrue(containers.get(0).getVolumeMounts().isEmpty());
}
Aggregations