use of io.fabric8.maven.core.config.VolumeConfig in project fabric8-maven-plugin by fabric8io.
the class ContainerHandlerTest method getVolumeMountWithoutMountTest.
@Test
public void getVolumeMountWithoutMountTest() {
ContainerHandler handler = new ContainerHandler(project, envVarHandler, probeHandler);
images.clear();
images.add(imageConfiguration1);
// volume config without mount
VolumeConfig volumeConfig1 = new VolumeConfig.Builder().name("first").build();
volumes1.add(volumeConfig1);
ResourceConfig config1 = new ResourceConfig.Builder().volumes(volumes1).build();
containers = handler.getContainers(config1, images);
assertTrue(containers.get(0).getVolumeMounts().isEmpty());
}
use of io.fabric8.maven.core.config.VolumeConfig in project fabric8-maven-plugin by fabric8io.
the class ContainerHandlerTest method getVolumeMountWithMultipleMountTest.
@Test
public void getVolumeMountWithMultipleMountTest() {
ContainerHandler handler = new ContainerHandler(project, envVarHandler, probeHandler);
images.clear();
images.add(imageConfiguration1);
List<String> mounts = new ArrayList<>();
mounts.add("/path/etc");
// volume config with name and multiple mount
mounts.add("/path/system");
mounts.add("/path/sys");
VolumeConfig volumeConfig4 = new VolumeConfig.Builder().name("test").mounts(mounts).build();
volumes1.clear();
volumes1.add(volumeConfig4);
ResourceConfig config4 = new ResourceConfig.Builder().volumes(volumes1).build();
containers = handler.getContainers(config4, images);
assertEquals(3, containers.get(0).getVolumeMounts().size());
for (int i = 0; i <= 2; i++) assertEquals("test", containers.get(0).getVolumeMounts().get(i).getName());
}
use of io.fabric8.maven.core.config.VolumeConfig in project fabric8-maven-plugin by fabric8io.
the class DaemonSetHandlerTest 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 = new VolumeConfig.Builder().name("test").mounts(mounts).type("hostPath").path("/test/path").build();
volumes1.add(volumeConfig1);
// container name with alias
BuildImageConfiguration buildImageConfiguration = new BuildImageConfiguration.Builder().ports(ports).from("fabric8/maven:latest").cleanup("try").tags(tags).compression("gzip").build();
ImageConfiguration imageConfiguration = new ImageConfiguration.Builder().name("test").alias("test-app").buildConfig(buildImageConfiguration).registry("docker.io").build();
images.add(imageConfiguration);
}
use of io.fabric8.maven.core.config.VolumeConfig in project fabric8-maven-plugin by fabric8io.
the class JobHandlerTest 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 = new VolumeConfig.Builder().name("test").mounts(mounts).type("hostPath").path("/test/path").build();
volumes1.add(volumeConfig1);
// container name with alias
BuildImageConfiguration buildImageConfiguration = new BuildImageConfiguration.Builder().ports(ports).from("fabric8/maven:latest").cleanup("try").tags(tags).compression("gzip").build();
ImageConfiguration imageConfiguration = new ImageConfiguration.Builder().name("test").alias("test-app").buildConfig(buildImageConfiguration).registry("docker.io").build();
images.add(imageConfiguration);
}
use of io.fabric8.maven.core.config.VolumeConfig 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());
}
Aggregations