diff options
author | Pete Bentley <prb@google.com> | 2019-03-01 15:09:20 +0000 |
---|---|---|
committer | Pete Bentley <prb@google.com> | 2019-03-01 16:39:48 +0000 |
commit | ecf36ae99570b1bb8512f573d7f29114f4b9cb6c (patch) | |
tree | 738b40bc3dd502f17e6044ded4b021164b876012 | |
parent | 47167645e9a10c9c816594196cd16cc9fee63cbf (diff) | |
download | okhttp-ecf36ae99570b1bb8512f573d7f29114f4b9cb6c.tar.gz |
Relax test constraint for disconnected HttpURLConnection.
During test the MockWebServer when exactly half of the request
has been read, and the test then asserts that the amouint of data
written to the socket before receiving an exception is within 1%
of the total. Automated testing on Taimen (see bug) sometimes
manages to write more which makes the test flake. As there is
always going to some non-determinism in IO buffering, bumping the
tolerance from 1% to 2% seems reasonable.
Bug: 126877539
Test: atest CtsLibcoreOkHttpTestCases
Change-Id: I1e11a5f31d499334e50d80505ebc0747c2a56d90
-rw-r--r-- | mockwebserver/src/test/java/com/squareup/okhttp/mockwebserver/MockWebServerTest.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mockwebserver/src/test/java/com/squareup/okhttp/mockwebserver/MockWebServerTest.java b/mockwebserver/src/test/java/com/squareup/okhttp/mockwebserver/MockWebServerTest.java index 573da65..24de0ac 100644 --- a/mockwebserver/src/test/java/com/squareup/okhttp/mockwebserver/MockWebServerTest.java +++ b/mockwebserver/src/test/java/com/squareup/okhttp/mockwebserver/MockWebServerTest.java @@ -278,7 +278,9 @@ public final class MockWebServerTest { break; } } - assertEquals(512f, i, 10f); // Halfway +/- 1% + // Android-changed: Values of i as high as 523 observed in tests, so 1% precision is too tight + // assertEquals(512f, i, 10f); // Halfway +/- 1% + assertEquals(512f, i, 20f); // Halfway +/- 2% of total buffer size } @Test public void disconnectResponseHalfway() throws IOException { |