use of com.netflix.titus.grpc.protogen.GetJobLoadBalancersResult in project titus-control-plane by Netflix.
the class AggregatingLoadBalancerServiceTest method getJobLoadBalancersWithOneFailingCell.
@Test
public void getJobLoadBalancersWithOneFailingCell() {
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<GetJobLoadBalancersResult> resultSubscriber = service.getLoadBalancers(JobId.newBuilder().setId(JOB_1).build(), JUNIT_REST_CALL_METADATA).test();
resultSubscriber.awaitValueCount(1, 1, TimeUnit.SECONDS);
resultSubscriber.assertNoErrors();
final List<GetJobLoadBalancersResult> onNextEvents = resultSubscriber.getOnNextEvents();
assertThat(onNextEvents).hasSize(1);
final List<LoadBalancerId> loadBalancersList = onNextEvents.get(0).getLoadBalancersList();
final List<String> resultLoadBalancers = loadBalancersList.stream().map(loadBalancerId -> loadBalancerId.getId()).collect(Collectors.toList());
assertThat(resultLoadBalancers).contains(LB_1, LB_2);
}
use of com.netflix.titus.grpc.protogen.GetJobLoadBalancersResult in project titus-control-plane by Netflix.
the class LoadBalancerResourceTest method getJobLoadBalancersTest.
@Test
public void getJobLoadBalancersTest() {
GetJobLoadBalancersResult expectedResult = GetJobLoadBalancersResult.newBuilder().build();
when(loadBalancerService.getLoadBalancers(any(), any())).thenReturn(Observable.just(expectedResult));
GetJobLoadBalancersResult actualResult = loadBalancerResource.getJobLoadBalancers(TEST_JOB_ID);
assertEquals(expectedResult, actualResult);
}
Aggregations