use of build.buildfarm.common.grpc.Retrier.NO_RETRIES in project bazel-buildfarm by bazelbuild.
the class ByteStreamHelperTest method newInputThrowsOnNotFound.
@SuppressWarnings("unchecked")
@Test
public void newInputThrowsOnNotFound() {
String resourceName = "not/found/resource";
ReadRequest readRequest = ReadRequest.newBuilder().setResourceName(resourceName).build();
doAnswer(invocation -> {
StreamObserver<ReadResponse> observer = invocation.getArgument(1);
observer.onError(Status.NOT_FOUND.asException());
return null;
}).when(serviceImpl).read(eq(readRequest), any(StreamObserver.class));
try (InputStream in = ByteStreamHelper.newInput(resourceName, /* offset=*/
0, Suppliers.ofInstance(ByteStreamGrpc.newStub(channel)), NO_RETRIES::newBackoff, NO_RETRIES::isRetriable, /* retryService=*/
null)) {
fail("should not get here");
} catch (IOException e) {
assertThat(e).isInstanceOf(NoSuchFileException.class);
}
verify(serviceImpl, times(1)).read(eq(readRequest), any(StreamObserver.class));
}
Aggregations