diff options
author | Loïc Hoguin <[email protected]> | 2019-09-19 15:14:31 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-09-22 16:46:35 +0200 |
commit | 02dd576a837b8b47b1c656c6f4b8769c1aeb4ed0 (patch) | |
tree | b405a4fc250ce60c7ee2fdba5e29858c54df8c4a /test/shutdown_SUITE.erl | |
parent | 617554f305dc3bd031779ba0b8ef8d52edb52edd (diff) | |
download | gun-02dd576a837b8b47b1c656c6f4b8769c1aeb4ed0.tar.gz gun-02dd576a837b8b47b1c656c6f4b8769c1aeb4ed0.tar.bz2 gun-02dd576a837b8b47b1c656c6f4b8769c1aeb4ed0.zip |
Add Socks5->HTTP/2 tests
Also consolidate the ALPN code in the tls_handshake state
rather than doing it in CONNECT/Socks separately.
Also improves the origin tests by sending a message once
the handshake is completed instead of having timeouts.
Diffstat (limited to 'test/shutdown_SUITE.erl')
-rw-r--r-- | test/shutdown_SUITE.erl | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/test/shutdown_SUITE.erl b/test/shutdown_SUITE.erl index d3a2f56..173fd50 100644 --- a/test/shutdown_SUITE.erl +++ b/test/shutdown_SUITE.erl @@ -19,6 +19,7 @@ -import(ct_helper, [doc/1]). -import(ct_helper, [config/2]). -import(gun_test, [init_origin/3]). +-import(gun_test, [receive_from/1]). all() -> [{group, shutdown}]. @@ -377,7 +378,7 @@ http2_server_goaway_one_stream(_) -> doc("HTTP/2: Confirm that the Gun process shuts down gracefully " "when receiving a GOAWAY frame with one active stream and " "retry is disabled."), - {ok, _, OriginPort} = init_origin(tcp, http2, fun(_, Socket, Transport) -> + {ok, OriginPid, OriginPort} = init_origin(tcp, http2, fun(_, Socket, Transport) -> %% Receive a HEADERS frame. {ok, <<SkipLen:24, 1:8, _:8, 1:32>>} = Transport:recv(Socket, 9, 1000), %% Skip the header. @@ -401,7 +402,7 @@ http2_server_goaway_one_stream(_) -> retry => 0 }), {ok, Protocol} = gun:await_up(ConnPid), - timer:sleep(100), %% Give enough time for the handshake to fully complete. + handshake_completed = receive_from(OriginPid), StreamRef = gun:get(ConnPid, "/"), ConnRef = monitor(process, ConnPid), {response, fin, 200, _} = gun:await(ConnPid, StreamRef), @@ -411,7 +412,7 @@ http2_server_goaway_many_streams(_) -> doc("HTTP/2: Confirm that the Gun process shuts down gracefully " "when receiving a GOAWAY frame with many active streams and " "retry is disabled."), - {ok, _, OriginPort} = init_origin(tcp, http2, fun(_, Socket, Transport) -> + {ok, OriginPid, OriginPort} = init_origin(tcp, http2, fun(_, Socket, Transport) -> %% Stream 1. %% Receive a HEADERS frame. {ok, <<SkipLen1:24, 1:8, _:8, 1:32>>} = Transport:recv(Socket, 9, 1000), @@ -458,7 +459,7 @@ http2_server_goaway_many_streams(_) -> retry => 0 }), {ok, Protocol} = gun:await_up(ConnPid), - timer:sleep(100), %% Give enough time for the handshake to fully complete. + handshake_completed = receive_from(OriginPid), StreamRef1 = gun:get(ConnPid, "/"), StreamRef2 = gun:get(ConnPid, "/"), StreamRef3 = gun:get(ConnPid, "/"), |