use of com.netflix.titus.master.integration.v3.scenario.JobScenarioBuilder in project titus-control-plane by Netflix.
the class JobSubmitAndControlBasicTest method testSubmitBatchJobWithEfsMount.
/**
* Verify batch job submit with the expected state transitions. Verify agent receives proper EFS mount data.
*/
@Test(timeout = 30_000)
public void testSubmitBatchJobWithEfsMount() {
EfsMount efsMount1 = ContainersGenerator.efsMounts().getValue().toBuilder().withMountPoint("/data/logs").build();
EfsMount efsMount2 = ContainersGenerator.efsMounts().skip(1).getValue().toBuilder().withMountPoint("/data").build();
List<EfsMount> efsMounts = asList(efsMount1, efsMount2);
List<EfsMount> expectedOrder = asList(efsMount2, efsMount1);
JobDescriptor<BatchJobExt> jobWithEfs = ONE_TASK_BATCH_JOB.but(jd -> jd.getContainer().but(c -> c.getContainerResources().toBuilder().withEfsMounts(efsMounts)));
jobsScenarioBuilder.schedule(jobWithEfs, jobScenarioBuilder -> jobScenarioBuilder.template(ScenarioTemplates.startTasksInNewJob()).assertEachPod(podWithEfsMounts(expectedOrder), "Container not assigned the expected EFS mount").allTasks(ScenarioTemplates.completeTask()).template(ScenarioTemplates.jobFinished()).expectJobEventStreamCompletes());
}
use of com.netflix.titus.master.integration.v3.scenario.JobScenarioBuilder in project titus-control-plane by Netflix.
the class JobsScenarioBuilder method schedule.
public JobsScenarioBuilder schedule(JobDescriptor<?> jobDescriptor, int times, Function<JobScenarioBuilder, JobScenarioBuilder> jobScenario) throws Exception {
String sequence = jobDescriptor.getJobGroupInfo().getSequence();
for (int i = 0; i < times; i++) {
int finalI = i;
JobDescriptor effective = sequence.isEmpty() ? jobDescriptor : jobDescriptor.but(jd -> jd.getJobGroupInfo().toBuilder().withSequence(sequence + '_' + finalI));
schedule(effective, jobScenario);
}
return this;
}
Aggregations