use of io.fabric8.openshift.api.model.Project in project fabric8-maven-plugin by fabric8io.
the class JobHandlerTest method daemonTemplateHandlerWithInvalidNameTest.
@Test(expected = IllegalArgumentException.class)
public void daemonTemplateHandlerWithInvalidNameTest() {
// invalid controller name
ContainerHandler containerHandler = new ContainerHandler(project, envVarHandler, probeHandler);
PodTemplateHandler podTemplateHandler = new PodTemplateHandler(containerHandler);
JobHandler jobHandler = new JobHandler(podTemplateHandler);
// with invalid controller name
ResourceConfig config = new ResourceConfig.Builder().imagePullPolicy("IfNotPresent").controllerName("TesTing").withServiceAccount("test-account").volumes(volumes1).build();
jobHandler.getJob(config, images);
}
use of io.fabric8.openshift.api.model.Project in project fabric8-maven-plugin by fabric8io.
the class PodTemplateHandlerTest method podWithVolumeTemplateHandlerTest.
@Test
public void podWithVolumeTemplateHandlerTest() {
ContainerHandler containerHandler = new ContainerHandler(project, envVarHandler, probeHandler);
PodTemplateHandler podTemplateHandler = new PodTemplateHandler(containerHandler);
// Config with Volume Config and ServiceAccount
// valid type
VolumeConfig volumeConfig1 = new VolumeConfig.Builder().name("test").mounts(mounts).type("hostPath").path("/test/path").build();
volumes1.clear();
volumes1.add(volumeConfig1);
ResourceConfig config = new ResourceConfig.Builder().imagePullPolicy("IfNotPresent").controllerName("testing").withServiceAccount("test-account").withReplicas(5).volumes(volumes1).build();
PodTemplateSpec podTemplateSpec = podTemplateHandler.getPodTemplate(config, images);
// Assertion
assertEquals("test-account", podTemplateSpec.getSpec().getServiceAccountName());
assertFalse(podTemplateSpec.getSpec().getVolumes().isEmpty());
assertEquals("test", podTemplateSpec.getSpec().getVolumes().get(0).getName());
assertEquals("/test/path", podTemplateSpec.getSpec().getVolumes().get(0).getHostPath().getPath());
assertNotNull(podTemplateSpec.getSpec().getContainers());
}
use of io.fabric8.openshift.api.model.Project in project fabric8-maven-plugin by fabric8io.
the class PodTemplateHandlerTest method podWithInvalidVolumeTypeTemplateHandlerTest.
@Test
public void podWithInvalidVolumeTypeTemplateHandlerTest() {
ContainerHandler containerHandler = new ContainerHandler(project, envVarHandler, probeHandler);
PodTemplateHandler podTemplateHandler = new PodTemplateHandler(containerHandler);
// invalid type
VolumeConfig volumeConfig1 = new VolumeConfig.Builder().name("test").mounts(mounts).type("hoStPath").path("/test/path").build();
volumes1.clear();
volumes1.add(volumeConfig1);
ResourceConfig config = new ResourceConfig.Builder().imagePullPolicy("IfNotPresent").controllerName("testing").withServiceAccount("test-account").withReplicas(5).volumes(volumes1).build();
PodTemplateSpec podTemplateSpec = podTemplateHandler.getPodTemplate(config, images);
// Assertion
assertEquals("test-account", podTemplateSpec.getSpec().getServiceAccountName());
assertTrue(podTemplateSpec.getSpec().getVolumes().isEmpty());
assertNotNull(podTemplateSpec.getSpec().getContainers());
}
use of io.fabric8.openshift.api.model.Project in project fabric8-maven-plugin by fabric8io.
the class PodTemplateHandlerTest method podWithEmotyVolumeTemplateHandlerTest.
@Test
public void podWithEmotyVolumeTemplateHandlerTest() {
ContainerHandler containerHandler = new ContainerHandler(project, envVarHandler, probeHandler);
PodTemplateHandler podTemplateHandler = new PodTemplateHandler(containerHandler);
// Pod with empty Volume Config and wihtout ServiceAccount
ResourceConfig config = new ResourceConfig.Builder().imagePullPolicy("IfNotPresent").controllerName("testing").withReplicas(5).volumes(volumes1).build();
PodTemplateSpec podTemplateSpec = podTemplateHandler.getPodTemplate(config, images);
// Assertion
assertNull(podTemplateSpec.getSpec().getServiceAccountName());
assertTrue(podTemplateSpec.getSpec().getVolumes().isEmpty());
assertNotNull(podTemplateSpec.getSpec().getContainers());
}
use of io.fabric8.openshift.api.model.Project in project fabric8-maven-plugin by fabric8io.
the class ReplicaSetHandlerTest method replicaSetHandlerWithoutControllerTest.
@Test(expected = IllegalArgumentException.class)
public void replicaSetHandlerWithoutControllerTest() {
// without controller name
ContainerHandler containerHandler = new ContainerHandler(project, envVarHandler, probeHandler);
PodTemplateHandler podTemplateHandler = new PodTemplateHandler(containerHandler);
ReplicaSetHandler replicaSetHandler = new ReplicaSetHandler(podTemplateHandler);
// without controller name
ResourceConfig config = new ResourceConfig.Builder().imagePullPolicy("IfNotPresent").withServiceAccount("test-account").withReplicas(5).volumes(volumes1).build();
replicaSetHandler.getReplicaSet(config, images);
}
Aggregations