diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2016-11-20 16:28:37 +0100 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2016-11-20 17:02:26 +0100 |
commit | f45034e8f1c5461d76873d9b4182efa2681ba331 (patch) | |
tree | 2c70732be6811279079c5fb111b7d88ac9c79b3e | |
parent | b6e419d6403cbd15eb4a95d4082f234dbf6acbf0 (diff) | |
download | mitmproxy-f45034e8f1c5461d76873d9b4182efa2681ba331.tar.gz mitmproxy-f45034e8f1c5461d76873d9b4182efa2681ba331.tar.bz2 mitmproxy-f45034e8f1c5461d76873d9b4182efa2681ba331.zip |
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): |