use of com.netflix.titus.api.jobmanager.service.JobManagerException in project titus-control-plane by Netflix.
the class DefaultLoadBalancerJobValidatorTest method testValidateJobIsService.
@Test
public void testValidateJobIsService() throws Exception {
when(jobOperations.getJob(JOB_ID)).thenReturn(Optional.of(Job.<BatchJobExt>newBuilder().withId(JOB_ID).withStatus(JobStatus.newBuilder().withState(JobState.Accepted).build()).withJobDescriptor(JobDescriptor.<BatchJobExt>newBuilder().build()).build()));
Throwable thrown = catchThrowable(() -> loadBalancerValidator.validateJobId(JOB_ID));
assertThat(thrown).isInstanceOf(JobManagerException.class);
assertThat(((JobManagerException) thrown).getErrorCode()).isEqualTo(JobManagerException.ErrorCode.NotServiceJob);
}
use of com.netflix.titus.api.jobmanager.service.JobManagerException in project titus-control-plane by Netflix.
the class MoveTaskTest method testMoveWithInvalidTargetJob.
@Test
public void testMoveWithInvalidTargetJob() {
JobDescriptor<ServiceJobExt> jobDescriptor = oneTaskServiceJobDescriptor();
JobScenarioBuilder sourceJobBuilder = startNewJob(jobDescriptor);
String sourceJobId = sourceJobBuilder.getJobId();
String targetJobId = startNewJob(oneTaskBatchJobDescriptor()).getJobId();
try {
sourceJobBuilder.moveTask(0, 0, sourceJobId, targetJobId);
} catch (JobManagerException e) {
assertThat(e.getErrorCode()).isEqualTo(JobManagerException.ErrorCode.NotServiceJob);
}
}
Aggregations