use of com.netflix.titus.master.integration.v3.scenario.ScenarioTemplates.killJob in project titus-control-plane by Netflix.
the class JobObserveTest method observeJobs.
@Test(timeout = LONG_TEST_TIMEOUT_MS)
public void observeJobs() throws InterruptedException {
TestStreamObserver<JobChangeNotification> subscriber = subscribe(ObserveJobsQuery.getDefaultInstance());
for (int i = 0; i < 2; i++) {
String jobId = jobsScenarioBuilder.scheduleAndReturnJob(oneTaskBatchJobDescriptor(), jobScenarioBuilder -> jobScenarioBuilder.template(startTasksInNewJob()).template(ScenarioTemplates.killJob())).getId();
JobChangeNotification event;
while (true) {
event = subscriber.takeNext(SHORT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
if (event.hasJobUpdate()) {
Job job = event.getJobUpdate().getJob();
assertThat(job.getId()).isEqualTo(jobId);
CellAssertions.assertCellInfo(job, EmbeddedTitusMaster.CELL_NAME);
if (job.getStatus().getState() == JobState.Finished) {
break;
}
}
}
}
subscriber.cancel();
}
Aggregations