aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google
diff options
context:
space:
mode:
authorGravatar Jakob Buchgraber <buchgr@google.com>2018-05-24 07:15:17 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-05-24 07:16:36 -0700
commit2a6051b0c74ce59e30522fbd509ccbb460289df7 (patch)
tree03c502091e0010fea366f31734daaaa089a58642 /src/test/java/com/google
parent268dfbd070bfd20ae721cd2518f30f52f9b21024 (diff)
remote/http: simplify download logic
Netty's HttpClientCodec always emits a LastHttpContent event and so we don't need to track the received bytes manually to know when we are done reading. The HttpBlobStore compares the hashes of the received bytes to give us confidence that what we received is correct. Closes #5244. PiperOrigin-RevId: 197887877
Diffstat (limited to 'src/test/java/com/google')
-rw-r--r--src/test/java/com/google/devtools/build/lib/remote/blobstore/http/HttpDownloadHandlerTest.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/remote/blobstore/http/HttpDownloadHandlerTest.java b/src/test/java/com/google/devtools/build/lib/remote/blobstore/http/HttpDownloadHandlerTest.java
index ac7bb00bd2..6453ed9b0f 100644
--- a/src/test/java/com/google/devtools/build/lib/remote/blobstore/http/HttpDownloadHandlerTest.java
+++ b/src/test/java/com/google/devtools/build/lib/remote/blobstore/http/HttpDownloadHandlerTest.java
@@ -33,6 +33,7 @@ import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpResponse;
import io.netty.handler.codec.http.HttpResponseStatus;
import io.netty.handler.codec.http.HttpVersion;
+import io.netty.handler.codec.http.LastHttpContent;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URI;
@@ -105,6 +106,7 @@ public class HttpDownloadHandlerTest extends AbstractHttpHandlerTest {
response.headers().set(HttpHeaders.CONTENT_LENGTH, 0);
response.headers().set(HttpHeaders.CONNECTION, HttpHeaderValues.KEEP_ALIVE);
ch.writeInbound(response);
+ ch.writeInbound(LastHttpContent.EMPTY_LAST_CONTENT);
assertThat(writePromise.isDone()).isTrue();
assertThat(writePromise.cause()).isInstanceOf(HttpException.class);
assertThat(((HttpException) writePromise.cause()).response().status())
@@ -142,6 +144,7 @@ public class HttpDownloadHandlerTest extends AbstractHttpHandlerTest {
assertThat(writePromise.isDone()).isFalse();
ch.writeInbound(new DefaultHttpContent(errorMessage));
+ ch.writeInbound(LastHttpContent.EMPTY_LAST_CONTENT);
assertThat(writePromise.isDone()).isTrue();
assertThat(writePromise.cause()).isInstanceOf(HttpException.class);
assertThat(((HttpException) writePromise.cause()).response().status())