use of com.netflix.titus.api.jobmanager.model.job.VolumeMount in project titus-control-plane by Netflix.
the class V1SpecPodFactoryTest method podMainContainerHasVolumeMounts.
@Test
public void podMainContainerHasVolumeMounts() {
Job<BatchJobExt> job = JobGenerator.oneBatchJob();
BatchJobTask task = JobGenerator.oneBatchTask();
List<VolumeMount> volumeMounts = Arrays.asList(new VolumeMount("volume1", "", NONE_MOUNT_PROPAGATION, false, ""), new VolumeMount("volume2", "", NONE_MOUNT_PROPAGATION, false, ""));
Container container = job.getJobDescriptor().getContainer().toBuilder().withVolumeMounts(volumeMounts).build();
job = job.toBuilder().withJobDescriptor(job.getJobDescriptor().toBuilder().withContainer(container).build()).build();
when(podAffinityFactory.buildV1Affinity(job, task)).thenReturn(Pair.of(new V1Affinity(), new HashMap<>()));
V1Pod pod = podFactory.buildV1Pod(job, task);
V1Container mainContainer = pod.getSpec().getContainers().get(0);
List<V1VolumeMount> mounts = mainContainer.getVolumeMounts();
// dev-shm is third volume
assertThat(mounts.size()).isEqualTo(3);
assertThat(mounts.get(0).getName()).isEqualTo("volume1");
assertThat(mounts.get(1).getName()).isEqualTo("volume2");
}
Aggregations