use of com.netflix.titus.grpc.protogen.RemoveLoadBalancerRequest in project titus-control-plane by Netflix.
the class AggregatingLoadbalancerService method removeLoadBalancer.
@Override
public Completable removeLoadBalancer(RemoveLoadBalancerRequest removeLoadBalancerRequest, CallMetadata callMetadata) {
JobId jobId = JobId.newBuilder().setId(removeLoadBalancerRequest.getJobId()).build();
final Observable<Empty> responseObservable = jobManagementServiceHelper.findJobInAllCells(jobId.getId(), callMetadata).flatMap(response -> singleCellCall(response.getCell(), (client, responseObserver) -> client.removeLoadBalancer(removeLoadBalancerRequest, responseObserver), callMetadata));
return responseObservable.toCompletable();
}
use of com.netflix.titus.grpc.protogen.RemoveLoadBalancerRequest in project titus-control-plane by Netflix.
the class LoadBalancerTests method removeLoadBalancerFromJob.
/**
* Common testing helper that removes a load balancer id from a job. The helper ensures the
* gRPC request was successful.
*/
public static void removeLoadBalancerFromJob(String jobId, LoadBalancerId loadBalancerId, BiConsumer<RemoveLoadBalancerRequest, TestStreamObserver<Empty>> removeLoadBalancers) {
RemoveLoadBalancerRequest request = RemoveLoadBalancerRequest.newBuilder().setJobId(jobId).setLoadBalancerId(loadBalancerId).build();
TestStreamObserver<Empty> removeResponse = new TestStreamObserver<>();
removeLoadBalancers.accept(request, removeResponse);
assertThatCode(removeResponse::awaitDone).doesNotThrowAnyException();
assertThat(removeResponse.hasError()).isFalse();
}
use of com.netflix.titus.grpc.protogen.RemoveLoadBalancerRequest in project titus-control-plane by Netflix.
the class LoadBalancerSpringResourceTest method testRemoveLoadBalancer.
@Test
public void testRemoveLoadBalancer() throws Exception {
RemoveLoadBalancerRequest forwardedRequest = RemoveLoadBalancerRequest.newBuilder().setJobId(JOB_ID).setLoadBalancerId(LoadBalancerId.newBuilder().setId(LOAD_BALANCER_ID).build()).build();
when(serviceMock.removeLoadBalancer(forwardedRequest, JUNIT_REST_CALL_METADATA)).thenReturn(Completable.complete());
SpringMockMvcUtil.doDelete(mockMvc, "/api/v3/loadBalancers", "jobId", JOB_ID, "loadBalancerId", LOAD_BALANCER_ID);
verify(serviceMock, times(1)).removeLoadBalancer(forwardedRequest, JUNIT_REST_CALL_METADATA);
}
Aggregations