use of com.netflix.titus.grpc.protogen.HealthCheckRequest in project titus-control-plane by Netflix.
the class AggregatingHealthServiceTest method grpcErrors.
@Test
public void grpcErrors() {
cellOne.getServiceRegistry().addService(new CellWithHealthStatus(ok("one")));
cellTwo.getServiceRegistry().addService(new HealthGrpc.HealthImplBase() {
@Override
public void check(HealthCheckRequest request, StreamObserver<HealthCheckResponse> responseObserver) {
responseObserver.onError(Status.DEADLINE_EXCEEDED.asRuntimeException());
}
});
AssertableSubscriber<HealthCheckResponse> subscriber = service.check(HealthCheckRequest.newBuilder().build()).test();
subscriber.awaitTerminalEvent(10, TimeUnit.SECONDS);
subscriber.assertNoErrors();
subscriber.assertValueCount(1);
HealthCheckResponse response = subscriber.getOnNextEvents().get(0);
assertThat(response.getStatus()).isEqualTo(NOT_SERVING);
assertThat(response.getDetailsCount()).isEqualTo(2);
List<ServerStatus> errors = response.getDetailsList().stream().filter(ServerStatus::hasError).collect(Collectors.toList());
assertThat(errors).hasSize(1);
assertThat(errors.get(0).getError().getCell()).isEqualTo("two");
assertThat(errors.get(0).getError().getErrorCode()).isEqualTo(DEADLINE_EXCEEDED.toString());
}
Aggregations