use of com.netflix.titus.api.loadbalancer.model.JobLoadBalancer in project titus-control-plane by Netflix.
the class LoadBalancerSanitizerBuilderTest method testJobLoadBalancerValidation.
@Test
public void testJobLoadBalancerValidation() throws Exception {
JobLoadBalancer jobLoadBalancer = new JobLoadBalancer("Some JobId", "Some LoadBalancerId");
assertThat(sanitizer.validate(jobLoadBalancer)).isEmpty();
}
use of com.netflix.titus.api.loadbalancer.model.JobLoadBalancer in project titus-control-plane by Netflix.
the class LoadBalancerSanitizerBuilderTest method testEmptyJobIdValidation.
@Test
public void testEmptyJobIdValidation() throws Exception {
JobLoadBalancer jobLoadBalancer = new JobLoadBalancer("", "Some LoadBalancerId");
assertThat(sanitizer.validate(jobLoadBalancer)).hasSize(1);
}
use of com.netflix.titus.api.loadbalancer.model.JobLoadBalancer in project titus-control-plane by Netflix.
the class LoadBalancerSanitizerBuilderTest method testEmptyLoadBalancerIdValidation.
@Test
public void testEmptyLoadBalancerIdValidation() throws Exception {
JobLoadBalancer jobLoadBalancer = new JobLoadBalancer("Some JobId", "");
assertThat(sanitizer.validate(jobLoadBalancer)).hasSize(1);
}
use of com.netflix.titus.api.loadbalancer.model.JobLoadBalancer in project titus-control-plane by Netflix.
the class AggregatingLoadBalancerServiceTest method addLoadBalancer.
@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);
}
use of com.netflix.titus.api.loadbalancer.model.JobLoadBalancer in project titus-control-plane by Netflix.
the class AggregatingLoadBalancerServiceTest method getAllLoadBalancersNoPagination.
@Test
public void getAllLoadBalancersNoPagination() {
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(singletonList(jobLoadBalancer2));
cellOne.getServiceRegistry().addService(cellWithLoadBalancersOne);
cellTwo.getServiceRegistry().addService(cellWithLoadBalancersTwo);
final AssertableSubscriber<GetAllLoadBalancersResult> resultSubscriber = service.getAllLoadBalancers(GetAllLoadBalancersRequest.newBuilder().setPage(Page.newBuilder().setPageNumber(0).setPageSize(10)).build(), JUNIT_REST_CALL_METADATA).test();
resultSubscriber.awaitValueCount(1, 1, TimeUnit.SECONDS);
resultSubscriber.assertNoErrors();
final List<GetAllLoadBalancersResult> onNextEvents = resultSubscriber.getOnNextEvents();
assertThat(onNextEvents).hasSize(1);
assertThat(onNextEvents.get(0).getJobLoadBalancersCount()).isEqualTo(2);
}
Aggregations