diff options
author | 2016-02-04 16:20:07 +0000 | |
---|---|---|
committer | 2016-02-04 18:15:53 +0000 | |
commit | 8eccb7f834a262b81e92140d9c3b968dc90d2c47 (patch) | |
tree | 6e9f6c387777bdb730be18177f046b4fe21471c0 /src/test/shell | |
parent | e950da41d8b502fd6c90b1995b878d586dda4510 (diff) |
Print truncation-specific error message when a server gives a too-short response
Fixes #834.
--
MOS_MIGRATED_REVID=113851710
Diffstat (limited to 'src/test/shell')
-rwxr-xr-x | src/test/shell/bazel/external_integration_test.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/shell/bazel/external_integration_test.sh b/src/test/shell/bazel/external_integration_test.sh index 7b50c6a4c8..a2c23760ff 100755 --- a/src/test/shell/bazel/external_integration_test.sh +++ b/src/test/shell/bazel/external_integration_test.sh @@ -741,4 +741,28 @@ EOF assert_contains "def" bazel-genfiles/external/x/catter.out } +function test_truncated() { + http_response="$TEST_TMPDIR/http_response" + cat > "$http_response" <<EOF +HTTP/1.0 200 OK +Content-length: 200 + +EOF + echo "foo" >> "$http_response" + echo ${nc_port:=$(pick_random_unused_tcp_port)} > /dev/null + nc_log="$TEST_TMPDIR/nc.log" + nc_l "$nc_port" < "$http_response" >& "$nc_log" & + nc_pid=$! + + cat > WORKSPACE <<EOF +http_archive( + name = "foo", + url = "http://localhost:$nc_port", + sha256 = "b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c", +) +EOF + bazel build @foo//bar &> $TEST_log || echo "Build failed, as expected" + expect_log "Expected 200B, got 4B" +} + run_suite "external tests" |