diff options
author | Thomas Kriechbaumer <Kriechi@users.noreply.github.com> | 2016-11-20 17:02:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-20 17:02:49 +0100 |
commit | 79c753d8f8ea934c0e3d7973ba520c6e3d903d9f (patch) | |
tree | ceae33e1f5d82268022ce07e36f0573fdb304f88 | |
parent | 078f36d86a939b479a8f670d761c0fc22930c5ce (diff) | |
parent | f45034e8f1c5461d76873d9b4182efa2681ba331 (diff) | |
download | mitmproxy-79c753d8f8ea934c0e3d7973ba520c6e3d903d9f.tar.gz mitmproxy-79c753d8f8ea934c0e3d7973ba520c6e3d903d9f.tar.bz2 mitmproxy-79c753d8f8ea934c0e3d7973ba520c6e3d903d9f.zip |
Merge pull request #1766 from Kriechi/fix-test-race
tests: fix race condition
-rw-r--r-- | test/mitmproxy/protocol/test_http2.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/test/mitmproxy/protocol/test_http2.py b/test/mitmproxy/protocol/test_http2.py index 4159686a..d135cf08 100644 --- a/test/mitmproxy/protocol/test_http2.py +++ b/test/mitmproxy/protocol/test_http2.py @@ -649,6 +649,9 @@ class TestPushPromise(_Http2Test): return True h2_conn.send_headers(1, [(':status', '200')]) + wfile.write(h2_conn.data_to_send()) + wfile.flush() + h2_conn.push_stream(1, 2, [ (':authority', "127.0.0.1:{}".format(cls.port)), (':method', 'GET'), @@ -656,6 +659,9 @@ class TestPushPromise(_Http2Test): (':path', '/pushed_stream_foo'), ('foo', 'bar') ]) + wfile.write(h2_conn.data_to_send()) + wfile.flush() + h2_conn.push_stream(1, 4, [ (':authority', "127.0.0.1:{}".format(cls.port)), (':method', 'GET'), @@ -672,12 +678,19 @@ class TestPushPromise(_Http2Test): wfile.flush() h2_conn.send_data(1, b'regular_stream') - h2_conn.send_data(2, b'pushed_stream_foo') - h2_conn.send_data(4, b'pushed_stream_bar') wfile.write(h2_conn.data_to_send()) wfile.flush() + h2_conn.end_stream(1) + wfile.write(h2_conn.data_to_send()) + wfile.flush() + + h2_conn.send_data(2, b'pushed_stream_foo') h2_conn.end_stream(2) + wfile.write(h2_conn.data_to_send()) + wfile.flush() + + h2_conn.send_data(4, b'pushed_stream_bar') h2_conn.end_stream(4) wfile.write(h2_conn.data_to_send()) wfile.flush() @@ -791,9 +804,6 @@ class TestPushPromise(_Http2Test): assert b'regular_stream' in bodies # the other two bodies might not be transmitted before the reset - pushed_flows = [flow for flow in self.master.state.flows if 'h2-pushed-stream' in flow.metadata] - assert len(pushed_flows) == 2 - @requires_alpn class TestConnectionLost(_Http2Test): |