Search in sources :

Example 6 with JobManagerException

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);
}
Also used : BatchJobExt(com.netflix.titus.api.jobmanager.model.job.ext.BatchJobExt) JobManagerException(com.netflix.titus.api.jobmanager.service.JobManagerException) AssertionsForClassTypes.catchThrowable(org.assertj.core.api.AssertionsForClassTypes.catchThrowable) Test(org.junit.Test)

Example 7 with JobManagerException

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);
    }
}
Also used : ServiceJobExt(com.netflix.titus.api.jobmanager.model.job.ext.ServiceJobExt) JobManagerException(com.netflix.titus.api.jobmanager.service.JobManagerException) JobScenarioBuilder(com.netflix.titus.master.jobmanager.service.integration.scenario.JobScenarioBuilder) Test(org.junit.Test)

Aggregations

JobManagerException (com.netflix.titus.api.jobmanager.service.JobManagerException)7 Test (org.junit.Test)5 AssertionsForClassTypes.catchThrowable (org.assertj.core.api.AssertionsForClassTypes.catchThrowable)3 EvictionQuota (com.netflix.titus.api.eviction.model.EvictionQuota)2 JobFunctions (com.netflix.titus.api.jobmanager.model.job.JobFunctions)2 Task (com.netflix.titus.api.jobmanager.model.job.Task)2 TaskState (com.netflix.titus.api.jobmanager.model.job.TaskState)2 ServiceJobExt (com.netflix.titus.api.jobmanager.model.job.ext.ServiceJobExt)2 JobScenarioBuilder (com.netflix.titus.master.jobmanager.service.integration.scenario.JobScenarioBuilder)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ContainerHealthState (com.netflix.titus.api.containerhealth.model.ContainerHealthState)1 ContainerHealthStatus (com.netflix.titus.api.containerhealth.model.ContainerHealthStatus)1 ContainerHealthService (com.netflix.titus.api.containerhealth.service.ContainerHealthService)1 Job (com.netflix.titus.api.jobmanager.model.job.Job)1 JobDescriptor (com.netflix.titus.api.jobmanager.model.job.JobDescriptor)1 AvailabilityPercentageLimitDisruptionBudgetPolicy (com.netflix.titus.api.jobmanager.model.job.disruptionbudget.AvailabilityPercentageLimitDisruptionBudgetPolicy)1 UnhealthyTasksLimitDisruptionBudgetPolicy (com.netflix.titus.api.jobmanager.model.job.disruptionbudget.UnhealthyTasksLimitDisruptionBudgetPolicy)1 BatchJobExt (com.netflix.titus.api.jobmanager.model.job.ext.BatchJobExt)1 V3JobOperations (com.netflix.titus.api.jobmanager.service.V3JobOperations)1 CallMetadata (com.netflix.titus.api.model.callmetadata.CallMetadata)1