use of com.netflix.titus.testkit.rx.ExtTestSubscriber 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);
});
}
use of com.netflix.titus.testkit.rx.ExtTestSubscriber in project titus-control-plane by Netflix.
the class RateLimiterInterceptorTest method executeRateLimitedAction.
private ModelAction executeRateLimitedAction(TitusChangeAction changeAction) {
ExtTestSubscriber<List<ModelActionHolder>> testSubscriber = new ExtTestSubscriber<>();
rateLimiterInterceptor.apply(changeAction).apply().subscribe(testSubscriber);
ModelAction updateAction = testSubscriber.takeNext().get(0).getAction();
assertThat(updateAction).isInstanceOf(TitusModelAction.class);
return updateAction;
}
use of com.netflix.titus.testkit.rx.ExtTestSubscriber in project titus-control-plane by Netflix.
the class JobScenarioBuilder method moveTask.
public JobScenarioBuilder moveTask(int taskIdx, int resubmit, String sourceJobId, String targetJobId) {
Task task = findTaskInActiveState(taskIdx, resubmit);
ExtTestSubscriber<Void> subscriber = new ExtTestSubscriber<>();
jobOperations.moveServiceTask(sourceJobId, targetJobId, task.getId(), callMetadata).subscribe(subscriber);
autoAdvanceUntilSuccessful(() -> checkOperationSubscriberAndThrowExceptionIfError(subscriber));
return this;
}
use of com.netflix.titus.testkit.rx.ExtTestSubscriber in project titus-control-plane by Netflix.
the class JobScenarioBuilder method changeCapacity.
public JobScenarioBuilder changeCapacity(Capacity newCapacity) {
ExtTestSubscriber<Void> subscriber = new ExtTestSubscriber<>();
CapacityAttributes capacityAttributes = JobModel.newCapacityAttributes(newCapacity).build();
jobOperations.updateJobCapacityAttributes(jobId, capacityAttributes, CHANGE_CAPACITY_CALL_METADATA).subscribe(subscriber);
autoAdvanceUntilSuccessful(() -> checkOperationSubscriberAndThrowExceptionIfError(subscriber));
return this;
}
Aggregations