use of com.netflix.titus.api.jobmanager.store.JobStoreException in project titus-control-plane by Netflix.
the class CassandraJobStoreTest method testRetrieveTask.
@Test
public void testRetrieveTask() {
JobStore store = getJobStore();
Job<BatchJobExt> job = createBatchJobObject();
store.init().await();
store.storeJob(job).await();
Pair<List<Job<?>>, Integer> jobsAndErrors = store.retrieveJobs().toBlocking().first();
checkRetrievedJob(job, jobsAndErrors.getLeft().get(0));
Task task = createTaskObject(job);
store.storeTask(task).await();
Task retrievedTask = store.retrieveTask(task.getId()).toBlocking().first();
checkRetrievedTask(task, retrievedTask);
// Check that archive access does not return anything.
try {
store.retrieveArchivedTask(task.getId()).toBlocking().first();
fail("Should not return active task");
} catch (JobStoreException e) {
assertThat(e.getErrorCode()).isEqualTo(JobStoreException.ErrorCode.TASK_DOES_NOT_EXIST);
}
}
use of com.netflix.titus.api.jobmanager.store.JobStoreException in project titus-control-plane by Netflix.
the class CassandraJobStoreTest method testRetrieveJobs.
@Test
public void testRetrieveJobs() {
Session session = cassandraCqlUnit.getSession();
JobStore bootstrappingStore = getJobStore(session);
Job<BatchJobExt> job = createBatchJobObject();
bootstrappingStore.storeJob(job).await();
JobStore store = getJobStore(session);
store.init().await();
Pair<List<Job<?>>, Integer> jobsAndErrors = store.retrieveJobs().toBlocking().first();
assertThat(jobsAndErrors.getLeft()).hasSize(1);
assertThat(jobsAndErrors.getRight()).isEqualTo(0);
checkRetrievedJob(job, jobsAndErrors.getLeft().get(0));
// Check that archive access does not return anything.
try {
store.retrieveArchivedJob(job.getId()).toBlocking().first();
fail("Should not return active job");
} catch (JobStoreException e) {
assertThat(e.getErrorCode()).isEqualTo(JobStoreException.ErrorCode.JOB_DOES_NOT_EXIST);
}
}
Aggregations