use of com.netflix.titus.api.jobmanager.model.job.BasicContainer in project titus-control-plane by Netflix.
the class V1SpecPodFactoryTest method multipleContainers.
@Test
public void multipleContainers() {
Job<BatchJobExt> job = JobGenerator.oneBatchJob();
BatchJobTask task = JobGenerator.oneBatchTask();
Image testImage = Image.newBuilder().withName("testImage").withDigest("123").build();
List<BasicContainer> extraContainers = Arrays.asList(new BasicContainer("extraContainer1", testImage, Collections.emptyList(), Collections.emptyList(), new HashMap<>(), Collections.emptyList()), new BasicContainer("extraContainer2", testImage, Collections.emptyList(), Collections.emptyList(), new HashMap<>(), Collections.emptyList()));
job = job.toBuilder().withJobDescriptor(job.getJobDescriptor().toBuilder().withExtraContainers(extraContainers).build()).build();
when(podAffinityFactory.buildV1Affinity(job, task)).thenReturn(Pair.of(new V1Affinity(), new HashMap<>()));
V1Pod pod = podFactory.buildV1Pod(job, task);
List<V1Container> containers = Objects.requireNonNull(pod.getSpec()).getContainers();
// 3 containers here, 1 from the main container, 2 from the extras
assertThat(containers.size()).isEqualTo(1 + extraContainers.size());
}
Aggregations