Java Code Examples for rx.observers.AssertableSubscriber#assertNoValues()

The following examples show how to use rx.observers.AssertableSubscriber#assertNoValues() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AggregatingJobServiceGatewayTest.java    From titus-control-plane with Apache License 2.0 6 votes vote down vote up
@Test
public void findJobsWithFailingCell() {
    List<Job> cellTwoSnapshot = new ArrayList<>();
    for (int i = 0; i < 5; i++) {
        cellTwoSnapshot.addAll(dataGenerator.newBatchJobs(5, GrpcJobManagementModelConverters::toGrpcJob));
        cellTwoSnapshot.addAll(dataGenerator.newServiceJobs(5, GrpcJobManagementModelConverters::toGrpcJob));
        clock.advanceTime(1, TimeUnit.MINUTES);
    }
    cellOne.getServiceRegistry().addService(new CellWithFailingJobManagementService());
    cellTwo.getServiceRegistry().addService(new CellWithFixedJobsService(cellTwoSnapshot, cellTwoUpdates.serialize()));

    JobQuery query = JobQuery.newBuilder()
            .setPage(toGrpcPage(Page.unlimited()))
            .build();

    final AssertableSubscriber<JobQueryResult> testSubscriber = service.findJobs(query, UNDEFINED_CALL_METADATA).test();
    testSubscriber.awaitTerminalEvent(1, TimeUnit.SECONDS);
    testSubscriber.assertError(Status.INTERNAL.asRuntimeException().getClass());
    testSubscriber.assertNoValues();
}
 
Example 2
Source File: AggregatingAutoScalingServiceTest.java    From titus-control-plane with Apache License 2.0 6 votes vote down vote up
@Test
public void getPoliciesFromTwoCellsWithOneFailing() {
    ScalingPolicyID policy1 = ScalingPolicyID.newBuilder().setId(POLICY_1).build();
    ScalingPolicyResult policyOneResult = ScalingPolicyResult.newBuilder().setId(policy1).build();

    CellWithPolicies cellOneService = new CellWithPolicies(Collections.singletonList(policyOneResult));
    CellWithFailingAutoscalingService badCell = new CellWithFailingAutoscalingService();

    cellOne.getServiceRegistry().addService(cellOneService);
    cellTwo.getServiceRegistry().addService(badCell);

    final AssertableSubscriber<GetPolicyResult> testSubscriber = service.getAllScalingPolicies(JUNIT_REST_CALL_METADATA).test();
    testSubscriber.awaitTerminalEvent(1, TimeUnit.SECONDS);
    testSubscriber.assertNoValues();
    testSubscriber.assertError(StatusRuntimeException.class);
    List<Throwable> onErrorEvents = testSubscriber.getOnErrorEvents();
    assertThat(onErrorEvents.size()).isEqualTo(1);
}
 
Example 3
Source File: AggregatingLoadBalancerServiceTest.java    From titus-control-plane with Apache License 2.0 6 votes vote down vote up
@Test
public void getLoadBalancersWithOneFailingCell() {
    JobLoadBalancer jobLoadBalancer1 = new JobLoadBalancer(JOB_1, LB_1);
    JobLoadBalancer jobLoadBalancer2 = new JobLoadBalancer(JOB_1, LB_2);
    final CellWithLoadBalancers cellWithLoadBalancersOne = new CellWithLoadBalancers(
            Arrays.asList(jobLoadBalancer1, jobLoadBalancer2));

    cellOne.getServiceRegistry().addService(cellWithLoadBalancersOne);
    cellTwo.getServiceRegistry().addService(new CellWithFailingLoadBalancers(Status.INTERNAL));

    final AssertableSubscriber<GetAllLoadBalancersResult> resultSubscriber = service.getAllLoadBalancers(
            GetAllLoadBalancersRequest.newBuilder().setPage(Page.newBuilder().setPageSize(10)).build(),
            JUNIT_REST_CALL_METADATA
    ).test();
    resultSubscriber.awaitTerminalEvent(1, TimeUnit.SECONDS);
    resultSubscriber.assertNoValues();
    final List<Throwable> onErrorEvents = resultSubscriber.getOnErrorEvents();
    assertThat(onErrorEvents).hasSize(1);
    assertThat(Status.fromThrowable(onErrorEvents.get(0))).isEqualTo(Status.INTERNAL);
}
 
Example 4
Source File: AwsObservableExtTest.java    From titus-control-plane with Apache License 2.0 6 votes vote down vote up
@Test
public void asyncActionSingle() throws Exception {
    AmazonWebServiceRequest someRequest = AmazonWebServiceRequest.NOOP;
    final MockAsyncClient<AmazonWebServiceRequest, String> client = new MockAsyncClient<>(someRequest, "some response");
    Single<String> single = AwsObservableExt.asyncActionSingle(supplier -> client.someAsyncOperation(supplier.handler()));

    TestScheduler testScheduler = Schedulers.test();
    final AssertableSubscriber<String> subscriber = single.subscribeOn(testScheduler).test();

    testScheduler.triggerActions();
    subscriber.assertNoValues();
    subscriber.assertNotCompleted();

    client.run();
    testScheduler.triggerActions();
    subscriber.assertValueCount(1);
    subscriber.assertValue("some response");
    subscriber.assertCompleted();
}
 
Example 5
Source File: AggregatingJobServiceGatewayTest.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Test
public void killJob() {
    Random random = new Random();
    List<Job> cellOneSnapshot = new ArrayList<>(dataGenerator.newServiceJobs(12, GrpcJobManagementModelConverters::toGrpcJob));
    List<Job> cellTwoSnapshot = new ArrayList<>(dataGenerator.newBatchJobs(7, GrpcJobManagementModelConverters::toGrpcJob));
    CellWithFixedJobsService cellOneService = new CellWithFixedJobsService(cellOneSnapshot, cellOneUpdates.serialize());
    CellWithFixedJobsService cellTwoService = new CellWithFixedJobsService(cellTwoSnapshot, cellTwoUpdates.serialize());
    cellOne.getServiceRegistry().addService(cellOneService);
    cellTwo.getServiceRegistry().addService(cellTwoService);

    Job killInCellOne = cellOneSnapshot.get(random.nextInt(cellOneSnapshot.size()));
    Job killInCellTwo = cellTwoSnapshot.get(random.nextInt(cellTwoSnapshot.size()));
    assertThat(cellOneService.currentJobs()).containsKey(killInCellOne.getId());
    assertThat(cellTwoService.currentJobs()).containsKey(killInCellTwo.getId());

    AssertableSubscriber<Void> testSubscriber = service.killJob(killInCellOne.getId(), UNDEFINED_CALL_METADATA).test();
    testSubscriber.awaitTerminalEvent(1, TimeUnit.SECONDS);
    testSubscriber.assertNoErrors();
    testSubscriber.assertNoValues();
    testSubscriber.assertCompleted();
    assertThat(cellOneService.currentJobs()).doesNotContainKey(killInCellOne.getId());
    assertThat(cellTwoService.currentJobs()).doesNotContainKey(killInCellOne.getId());
    testSubscriber.unsubscribe();

    testSubscriber = service.killJob(killInCellTwo.getId(), UNDEFINED_CALL_METADATA).test();
    testSubscriber.awaitTerminalEvent(1, TimeUnit.SECONDS);
    testSubscriber.assertNoErrors();
    testSubscriber.assertNoValues();
    testSubscriber.assertCompleted();
    assertThat(cellOneService.currentJobs()).doesNotContainKey(killInCellTwo.getId());
    assertThat(cellTwoService.currentJobs()).doesNotContainKey(killInCellTwo.getId());
    testSubscriber.unsubscribe();
}
 
Example 6
Source File: AggregatingJobServiceGatewayTest.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Test
public void observeJob() {
    String cellOneJobId = UUID.randomUUID().toString();
    String cellTwoJobId = UUID.randomUUID().toString();
    cellOne.getServiceRegistry().addService(new CellWithJobStream(cellOneJobId, cellOneUpdates.serialize()));
    cellTwo.getServiceRegistry().addService(new CellWithJobStream(cellTwoJobId, cellTwoUpdates.serialize()));

    AssertableSubscriber<JobChangeNotification> subscriber1 = service.observeJob(cellOneJobId, UNDEFINED_CALL_METADATA).test();
    AssertableSubscriber<JobChangeNotification> subscriber2 = service.observeJob(cellTwoJobId, UNDEFINED_CALL_METADATA).test();

    cellOneUpdates.onNext(toNotification(Job.newBuilder().setId(cellOneJobId).setStatus(ACCEPTED_STATE).build()));
    cellOneUpdates.onNext(toNotification(Job.newBuilder().setId(cellOneJobId).setStatus(KILL_INITIATED_STATE).build()));
    cellOneUpdates.onNext(toNotification(Job.newBuilder().setId(cellOneJobId).setStatus(FINISHED_STATE).build()));
    cellOneUpdates.onNext(toNotification(Job.newBuilder().setId(cellOneJobId).setStatus(ACCEPTED_STATE).build()));

    subscriber1.awaitValueCount(3, 5, TimeUnit.SECONDS);
    subscriber1.assertNoErrors();
    subscriber1.assertNotCompleted();
    assertThat(subscriber1.isUnsubscribed()).isFalse();

    subscriber2.assertNoErrors();
    subscriber2.assertNoValues();
    subscriber2.assertNotCompleted();

    cellTwoUpdates.onNext(toNotification(Task.newBuilder()
            .setId(cellTwoJobId + "-task1").setJobId(cellTwoJobId)
            .build())
    );
    subscriber2.awaitValueCount(1, 1, TimeUnit.SECONDS);
    subscriber2.assertNoErrors();
    subscriber2.assertNotCompleted();

    cellOneUpdates.onCompleted();

    subscriber1.awaitTerminalEvent(1, TimeUnit.SECONDS);
    assertThat(subscriber1.getOnErrorEvents()).isEmpty();
    assertThat(subscriber1.isUnsubscribed()).isTrue();
    assertThat(subscriber1.getCompletions()).isEqualTo(1);
}
 
Example 7
Source File: AggregatingAutoScalingServiceTest.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Test
public void getPolicyByIdFromTwoCells() {
    ScalingPolicyID policy1 = ScalingPolicyID.newBuilder().setId(POLICY_1).build();
    ScalingPolicyID policy2 = ScalingPolicyID.newBuilder().setId(POLICY_2).build();

    ScalingPolicyResult policyOneResult = ScalingPolicyResult.newBuilder().setId(policy1).build();
    ScalingPolicyResult policyTwoResult = ScalingPolicyResult.newBuilder().setId(policy2).build();

    CellWithPolicies cellOneService = new CellWithPolicies(Collections.singletonList(policyOneResult));
    CellWithPolicies cellTwoService = new CellWithPolicies(Collections.singletonList(policyTwoResult));

    cellOne.getServiceRegistry().addService(cellOneService);
    cellTwo.getServiceRegistry().addService(cellTwoService);

    AssertableSubscriber<GetPolicyResult> testSubscriber = service.getScalingPolicy(
            ScalingPolicyID.newBuilder().setId(POLICY_2).build(), JUNIT_REST_CALL_METADATA).test();

    testSubscriber.awaitValueCount(1, 1, TimeUnit.SECONDS);

    List<GetPolicyResult> onNextEvents = testSubscriber.getOnNextEvents();
    assertThat(onNextEvents).isNotNull();
    assertThat(onNextEvents.size()).isEqualTo(1);
    assertThat(onNextEvents.get(0).getItemsCount()).isEqualTo(1);

    // Bad id. The current behavior is "INTERNAL: Completed without a response", but it will change to NOT_FOUND someday
    testSubscriber = service.getScalingPolicy(ScalingPolicyID.newBuilder().setId("badID").build(), JUNIT_REST_CALL_METADATA).test();
    testSubscriber.awaitTerminalEvent(1, TimeUnit.SECONDS);
    testSubscriber.assertError(StatusRuntimeException.class);
    testSubscriber.assertNoValues();
    List<Throwable> onErrorEvents = testSubscriber.getOnErrorEvents();
    assertThat(onErrorEvents).isNotNull();
    assertThat(onErrorEvents).hasSize(1);
    assertThat(Status.fromThrowable(onErrorEvents.get(0)).getCode()).isEqualTo(Status.CANCELLED.getCode());
}
 
Example 8
Source File: AggregatingLoadBalancerServiceTest.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Test
public void addLoadBalancer() {
    JobLoadBalancer jobLoadBalancer1 = new JobLoadBalancer(JOB_1, LB_1);
    JobLoadBalancer jobLoadBalancer2 = new JobLoadBalancer(JOB_2, LB_2);
    final CellWithLoadBalancers cellWithLoadBalancersOne = new CellWithLoadBalancers(singletonList(jobLoadBalancer1));
    final CellWithLoadBalancers cellWithLoadBalancersTwo = new CellWithLoadBalancers(new ArrayList<>(singletonList(jobLoadBalancer2)));

    final CellWithJobIds cellWithJobIdsOne = new CellWithJobIds(singletonList(JOB_1));
    final CellWithJobIds cellWithJobIdsTwo = new CellWithJobIds(singletonList(JOB_2));

    cellOne.getServiceRegistry().addService(cellWithLoadBalancersOne);
    cellOne.getServiceRegistry().addService(cellWithJobIdsOne);
    cellTwo.getServiceRegistry().addService(cellWithLoadBalancersTwo);
    cellTwo.getServiceRegistry().addService(cellWithJobIdsTwo);

    final AssertableSubscriber<Void> resultSubscriber = service.addLoadBalancer(
            AddLoadBalancerRequest.newBuilder().setJobId(JOB_2).setLoadBalancerId(LoadBalancerId.newBuilder().setId(LB_3).build()).build(),
            JUNIT_REST_CALL_METADATA
    ).test();
    resultSubscriber.awaitTerminalEvent(1, TimeUnit.SECONDS);
    resultSubscriber.assertNoErrors();
    resultSubscriber.assertNoValues();
    resultSubscriber.assertCompleted();

    final AssertableSubscriber<GetJobLoadBalancersResult> jobResults = service.getLoadBalancers(
            JobId.newBuilder().setId(JOB_2).build(),
            JUNIT_REST_CALL_METADATA
    ).test();
    jobResults.assertNoErrors();
    final List<GetJobLoadBalancersResult> onNextEvents = jobResults.getOnNextEvents();
    assertThat(onNextEvents.size()).isEqualTo(1);
    final List<LoadBalancerId> loadBalancersList = onNextEvents.get(0).getLoadBalancersList();
    assertThat(loadBalancersList.size()).isEqualTo(2);

    final List<String> resultLoadBalancerIds = loadBalancersList.stream().map(LoadBalancerId::getId).collect(Collectors.toList());
    assertThat(resultLoadBalancerIds).contains(LB_2, LB_3);
}
 
Example 9
Source File: AggregatingLoadBalancerServiceTest.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Test
public void removeLoadBalancer() {
    JobLoadBalancer jobLoadBalancer1 = new JobLoadBalancer(JOB_1, LB_1);
    JobLoadBalancer jobLoadBalancer2 = new JobLoadBalancer(JOB_2, LB_2);
    JobLoadBalancer jobLoadBalancer3 = new JobLoadBalancer(JOB_2, LB_3);
    final CellWithLoadBalancers cellWithLoadBalancersOne = new CellWithLoadBalancers(singletonList(jobLoadBalancer1));
    final CellWithLoadBalancers cellWithLoadBalancersTwo = new CellWithLoadBalancers(new ArrayList<>(Arrays.asList(jobLoadBalancer2, jobLoadBalancer3)));

    final CellWithJobIds cellWithJobIdsOne = new CellWithJobIds(singletonList(JOB_1));
    final CellWithJobIds cellWithJobIdsTwo = new CellWithJobIds(singletonList(JOB_2));

    cellOne.getServiceRegistry().addService(cellWithLoadBalancersOne);
    cellOne.getServiceRegistry().addService(cellWithJobIdsOne);
    cellTwo.getServiceRegistry().addService(cellWithLoadBalancersTwo);
    cellTwo.getServiceRegistry().addService(cellWithJobIdsTwo);

    final AssertableSubscriber<Void> resultSubscriber = service.removeLoadBalancer(
            RemoveLoadBalancerRequest.newBuilder().setJobId(JOB_2).setLoadBalancerId(LoadBalancerId.newBuilder().setId(LB_2).build()).build(),
            JUNIT_REST_CALL_METADATA
    ).test();
    resultSubscriber.awaitTerminalEvent(1, TimeUnit.SECONDS);
    resultSubscriber.assertNoErrors();
    resultSubscriber.assertNoValues();
    resultSubscriber.assertCompleted();

    final AssertableSubscriber<GetJobLoadBalancersResult> jobResults = service.getLoadBalancers(
            JobId.newBuilder().setId(JOB_2).build(),
            JUNIT_REST_CALL_METADATA
    ).test();
    jobResults.awaitValueCount(1, 1, TimeUnit.SECONDS);
    jobResults.assertNoErrors();
    final List<GetJobLoadBalancersResult> onNextEvents = jobResults.getOnNextEvents();
    assertThat(onNextEvents.size()).isEqualTo(1);
    final List<LoadBalancerId> loadBalancersList = onNextEvents.get(0).getLoadBalancersList();
    assertThat(loadBalancersList.size()).isEqualTo(1);
    assertThat(loadBalancersList.get(0).getId()).isEqualTo(LB_3);
}
 
Example 10
Source File: AggregatingLoadBalancerServiceTest.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Test
public void getLoadBalancersWithTwoFailingCell() {
    cellOne.getServiceRegistry().addService(new CellWithFailingLoadBalancers(Status.UNAVAILABLE));
    cellTwo.getServiceRegistry().addService(new CellWithFailingLoadBalancers(Status.INTERNAL));

    final AssertableSubscriber<GetAllLoadBalancersResult> resultSubscriber = service.getAllLoadBalancers(
            GetAllLoadBalancersRequest.newBuilder().setPage(Page.newBuilder().setPageSize(10)).build(),
            JUNIT_REST_CALL_METADATA
    ).test();
    resultSubscriber.awaitTerminalEvent(1, TimeUnit.SECONDS);
    resultSubscriber.assertNoValues();
    final List<Throwable> onErrorEvents = resultSubscriber.getOnErrorEvents();
    assertThat(onErrorEvents).hasSize(1);
    assertThat(Status.fromThrowable(onErrorEvents.get(0))).isEqualTo(Status.INTERNAL);
}
 
Example 11
Source File: AggregatingLoadBalancerServiceTest.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Test
public void getJobLoadBalancersWithTwoFailingCell() {
    cellOne.getServiceRegistry().addService(new CellWithFailingLoadBalancers(Status.NOT_FOUND));
    cellTwo.getServiceRegistry().addService(new CellWithFailingLoadBalancers(Status.INTERNAL));

    final AssertableSubscriber<GetJobLoadBalancersResult> resultSubscriber = service.getLoadBalancers(
            JobId.newBuilder().setId(JOB_1).build(),
            JUNIT_REST_CALL_METADATA
    ).test();
    resultSubscriber.awaitTerminalEvent(1, TimeUnit.SECONDS);
    resultSubscriber.assertNoValues();
    final List<Throwable> onErrorEvents = resultSubscriber.getOnErrorEvents();
    assertThat(onErrorEvents).hasSize(1);
    assertThat(Status.fromThrowable(onErrorEvents.get(0))).isEqualTo(Status.INTERNAL);
}
 
Example 12
Source File: AggregatingLoadBalancerServiceTest.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
@Test
public void getJobLoadBalancersInvalidJobId() {
    cellOne.getServiceRegistry().addService(new CellWithFailingLoadBalancers(Status.NOT_FOUND));
    cellTwo.getServiceRegistry().addService(new CellWithFailingLoadBalancers(Status.NOT_FOUND));

    final AssertableSubscriber<GetJobLoadBalancersResult> resultSubscriber = service.getLoadBalancers(
            JobId.newBuilder().setId(JOB_1).build(),
            JUNIT_REST_CALL_METADATA
    ).test();
    resultSubscriber.awaitTerminalEvent(1, TimeUnit.SECONDS);
    resultSubscriber.assertNoValues();
    final List<Throwable> onErrorEvents = resultSubscriber.getOnErrorEvents();
    assertThat(onErrorEvents).hasSize(1);
    assertThat(Status.fromThrowable(onErrorEvents.get(0))).isEqualTo(Status.NOT_FOUND);
}
 
Example 13
Source File: AggregatingJobServiceGatewayTest.java    From titus-control-plane with Apache License 2.0 4 votes vote down vote up
@Test
public void singleJobUpdates() {
    Random random = new Random();
    List<String> cellOneSnapshot = new ArrayList<>(dataGenerator.newServiceJobs(12)).stream()
            .map(job -> job.getId())
            .collect(Collectors.toList());
    List<String> cellTwoSnapshot = new ArrayList<>(dataGenerator.newBatchJobs(7)).stream()
            .map(job -> job.getId())
            .collect(Collectors.toList());
    CellWithJobIds cellOneService = new CellWithJobIds(cellOneSnapshot);
    CellWithJobIds cellTwoService = new CellWithJobIds(cellTwoSnapshot);
    cellOne.getServiceRegistry().addService(cellOneService);
    cellTwo.getServiceRegistry().addService(cellTwoService);

    String cellOneJobId = cellOneSnapshot.get(random.nextInt(cellOneSnapshot.size()));
    String cellTwoJobId = cellTwoSnapshot.get(random.nextInt(cellTwoSnapshot.size()));
    assertThat(cellOneService.containsCapacityUpdates(cellOneJobId)).isFalse();
    assertThat(cellTwoService.containsCapacityUpdates(cellOneJobId)).isFalse();

    JobCapacityUpdate cellOneUpdate = JobCapacityUpdate.newBuilder()
            .setJobId(cellOneJobId)
            .setCapacity(Capacity.newBuilder()
                    .setMax(1).setDesired(2).setMax(3)
                    .build())
            .build();
    AssertableSubscriber<Void> testSubscriber = service.updateJobCapacity(cellOneUpdate, UNDEFINED_CALL_METADATA).test();
    testSubscriber.awaitTerminalEvent(1, TimeUnit.SECONDS);
    testSubscriber.assertNoErrors();
    testSubscriber.assertNoValues();
    testSubscriber.assertCompleted();
    assertThat(cellOneService.containsCapacityUpdates(cellOneJobId)).isTrue();
    assertThat(cellTwoService.containsCapacityUpdates(cellOneJobId)).isFalse();
    testSubscriber.unsubscribe();

    JobCapacityUpdate cellTwoUpdate = JobCapacityUpdate.newBuilder()
            .setJobId(cellTwoJobId)
            .setCapacity(Capacity.newBuilder()
                    .setMax(2).setDesired(2).setMax(2)
                    .build())
            .build();
    testSubscriber = service.updateJobCapacity(cellTwoUpdate, UNDEFINED_CALL_METADATA).test();
    testSubscriber.awaitTerminalEvent(1, TimeUnit.SECONDS);
    testSubscriber.assertNoErrors();
    testSubscriber.assertNoValues();
    testSubscriber.assertCompleted();
    assertThat(cellOneService.containsCapacityUpdates(cellTwoJobId)).isFalse();
    assertThat(cellTwoService.containsCapacityUpdates(cellTwoJobId)).isTrue();
    testSubscriber.unsubscribe();
}
 
Example 14
Source File: AggregatingJobServiceGatewayTest.java    From titus-control-plane with Apache License 2.0 4 votes vote down vote up
@Test
public void killTask() {
    Random random = new Random();
    List<Task> cellOneSnapshot = new ArrayList<>(dataGenerator.newServiceJobWithTasks());
    List<Task> cellTwoSnapshot = new ArrayList<>(dataGenerator.newBatchJobWithTasks());
    CellWithFixedTasksService cellOneService = new CellWithFixedTasksService(cellOneSnapshot);
    CellWithFixedTasksService cellTwoService = new CellWithFixedTasksService(cellTwoSnapshot);
    cellOne.getServiceRegistry().addService(cellOneService);
    cellTwo.getServiceRegistry().addService(cellTwoService);

    Task killInCellOne = cellOneSnapshot.get(random.nextInt(cellOneSnapshot.size()));
    Task killInCellTwo = cellTwoSnapshot.get(random.nextInt(cellTwoSnapshot.size()));
    assertThat(cellOneService.currentTasks()).containsKey(killInCellOne.getId());
    assertThat(cellTwoService.currentTasks()).containsKey(killInCellTwo.getId());

    TaskKillRequest cellOneRequest = TaskKillRequest.newBuilder()
            .setTaskId(killInCellOne.getId())
            .setShrink(false)
            .build();
    AssertableSubscriber<Void> testSubscriber = service.killTask(cellOneRequest, UNDEFINED_CALL_METADATA).test();
    testSubscriber.awaitTerminalEvent(1, TimeUnit.SECONDS);
    testSubscriber.assertNoErrors();
    testSubscriber.assertNoValues();
    testSubscriber.assertCompleted();
    assertThat(cellOneService.currentTasks()).doesNotContainKey(killInCellOne.getId());
    assertThat(cellTwoService.currentTasks()).doesNotContainKey(killInCellOne.getId());
    testSubscriber.unsubscribe();

    TaskKillRequest cellTwoRequest = TaskKillRequest.newBuilder()
            .setTaskId(killInCellTwo.getId())
            .setShrink(false)
            .build();
    testSubscriber = service.killTask(cellTwoRequest, UNDEFINED_CALL_METADATA).test();
    testSubscriber.awaitTerminalEvent(1, TimeUnit.SECONDS);
    testSubscriber.assertNoErrors();
    testSubscriber.assertNoValues();
    testSubscriber.assertCompleted();
    assertThat(cellOneService.currentTasks()).doesNotContainKey(killInCellTwo.getId());
    assertThat(cellTwoService.currentTasks()).doesNotContainKey(killInCellTwo.getId());
    testSubscriber.unsubscribe();
}