Search in sources :

Example 6 with JobScenarioBuilder

use of com.netflix.titus.master.jobmanager.service.integration.scenario.JobScenarioBuilder in project titus-control-plane by Netflix.

the class MoveTaskTest method testMoveTimeout.

@Test
public void testMoveTimeout() {
    JobDescriptor<ServiceJobExt> jobDescriptor = oneTaskServiceJobDescriptor();
    JobScenarioBuilder sourceJobBuilder = startNewJob(jobDescriptor);
    String sourceJobId = sourceJobBuilder.getJobId();
    String targetJobId = startNewJob(jobDescriptor).getJobId();
    sourceJobBuilder.advance().slowStore().inTask(0, 0, task -> {
        ExtTestSubscriber<Void> testSubscriber = new ExtTestSubscriber<>();
        jobsScenarioBuilder.getJobOperations().moveServiceTask(sourceJobId, targetJobId, task.getId(), callMetadata).timeout(1, TimeUnit.SECONDS, testScheduler).subscribe(testSubscriber);
        testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
        assertThat(testSubscriber.isError()).isTrue();
        assertThat(testSubscriber.getError()).isInstanceOf(TimeoutException.class);
    });
}
Also used : ExtTestSubscriber(com.netflix.titus.testkit.rx.ExtTestSubscriber) ServiceJobExt(com.netflix.titus.api.jobmanager.model.job.ext.ServiceJobExt) JobScenarioBuilder(com.netflix.titus.master.jobmanager.service.integration.scenario.JobScenarioBuilder) Test(org.junit.Test)

Example 7 with JobScenarioBuilder

use of com.netflix.titus.master.jobmanager.service.integration.scenario.JobScenarioBuilder in project titus-control-plane by Netflix.

the class TaskRetryPolicyTest method failRetryableTask.

private void failRetryableTask(int[] delays, TimeUnit timeUnit, int retries) {
    JobScenarioBuilder jobScenario = jobsScenarioBuilder.getJobScenario(0);
    for (int i = 0; i < retries; i++) {
        int retryDelay = delays[i];
        jobScenario.template(ScenarioTemplates.failRetryableTask(0, i, timeUnit.toMillis(retryDelay)));
    }
}
Also used : JobScenarioBuilder(com.netflix.titus.master.jobmanager.service.integration.scenario.JobScenarioBuilder)

Aggregations

JobScenarioBuilder (com.netflix.titus.master.jobmanager.service.integration.scenario.JobScenarioBuilder)7 ServiceJobExt (com.netflix.titus.api.jobmanager.model.job.ext.ServiceJobExt)4 Test (org.junit.Test)4 JobManagerException (com.netflix.titus.api.jobmanager.service.JobManagerException)3 ExtTestSubscriber (com.netflix.titus.testkit.rx.ExtTestSubscriber)3 JobDescriptor (com.netflix.titus.api.jobmanager.model.job.JobDescriptor)2 JobFunctions (com.netflix.titus.api.jobmanager.model.job.JobFunctions)2 TaskState (com.netflix.titus.api.jobmanager.model.job.TaskState)2 CallMetadata (com.netflix.titus.api.model.callmetadata.CallMetadata)2 CollectionsExt (com.netflix.titus.common.util.CollectionsExt)2 ExceptionExt (com.netflix.titus.common.util.ExceptionExt)2 JobsScenarioBuilder (com.netflix.titus.master.jobmanager.service.integration.scenario.JobsScenarioBuilder)2 ScenarioTemplates (com.netflix.titus.master.jobmanager.service.integration.scenario.ScenarioTemplates)2 JobDescriptorGenerator.oneTaskBatchJobDescriptor (com.netflix.titus.testkit.model.job.JobDescriptorGenerator.oneTaskBatchJobDescriptor)2 JobDescriptorGenerator.oneTaskServiceJobDescriptor (com.netflix.titus.testkit.model.job.JobDescriptorGenerator.oneTaskServiceJobDescriptor)2 TimeUnit (java.util.concurrent.TimeUnit)2 TimeoutException (java.util.concurrent.TimeoutException)2 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)2 TestScheduler (rx.schedulers.TestScheduler)2