aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSorin Basca <sorinbasca@google.com>2021-07-14 11:21:08 +0000
committerSorin Basca <sorinbasca@google.com>2021-07-15 12:59:42 +0000
commit541335a9306579edf064d1be862192891697050d (patch)
tree68c3c5d845fbb32f7070af14a0fa14ae42174d58
parenta40903c6d4b947e0c4503e0ed753746f2ae5d41a (diff)
downloadokhttp-541335a9306579edf064d1be862192891697050d.tar.gz
Fixing stability of headersOnlyStreamIsClosedAfterReplyHeaders
Spdy3ConnectionTest.headersOnlyStreamIsClosedAfterReplyHeaders was occasionally failing. The error seems to be due to the fact that when a new stream is created, if only headers are exchanged and the exchange happens too quickly, then the stream is not marked as open, which causes the test to fail, as it expects an open stream after creation. This was fixed in upstream by removing the check that fails due to race conditions. See https://github.com/square/okhttp/commit/49dfda04ae9df1b915ccea17ca1e70ff48e06e6c (cherry picked from commit 9a853ef51ae582db4c7062d0410222379fb6e411) Bug: 191097565 Test: atest CtsLibcoreOkHttpTestCases: com.squareup.okhttp.internal.framed.Spdy3ConnectionTest --iterations 1000 Merged-In: Ic73d98407c617ea86bf4a6689109d55240043670 Change-Id: Ic73d98407c617ea86bf4a6689109d55240043670
-rw-r--r--okhttp-tests/src/test/java/com/squareup/okhttp/internal/framed/Spdy3ConnectionTest.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/okhttp-tests/src/test/java/com/squareup/okhttp/internal/framed/Spdy3ConnectionTest.java b/okhttp-tests/src/test/java/com/squareup/okhttp/internal/framed/Spdy3ConnectionTest.java
index 38961ef..e0f22d7 100644
--- a/okhttp-tests/src/test/java/com/squareup/okhttp/internal/framed/Spdy3ConnectionTest.java
+++ b/okhttp-tests/src/test/java/com/squareup/okhttp/internal/framed/Spdy3ConnectionTest.java
@@ -103,7 +103,8 @@ public final class Spdy3ConnectionTest {
FramedConnection connection = connection(peer, SPDY3);
FramedStream stream = connection.newStream(headerEntries("a", "android"), false, false);
- assertEquals(1, connection.openStreamCount());
+ // We cannot reliably check connection.openStreamCount as the stream gets closed once headers
+ // are exchanged and this can happen before newStream returns
assertEquals(headerEntries("b", "banana"), stream.getResponseHeaders());
connection.ping().roundTripTime(); // Ensure that inFinished has been received.
assertEquals(0, connection.openStreamCount());