From ef426e0ff460b5d3f1b119f7b27ab1bdb5a24511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 13 Aug 2018 11:09:24 +0200 Subject: Fix the infinity timeout tests Make sure the test fails when the code is incorrect. --- test/http2_SUITE.erl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'test/http2_SUITE.erl') diff --git a/test/http2_SUITE.erl b/test/http2_SUITE.erl index b71b2c9..ba95173 100644 --- a/test/http2_SUITE.erl +++ b/test/http2_SUITE.erl @@ -18,6 +18,7 @@ -import(ct_helper, [config/2]). -import(ct_helper, [doc/1]). +-import(ct_helper, [get_remote_pid_tcp/1]). -import(ct_helper, [name/0]). -import(cowboy_test, [gun_open/1]). @@ -131,10 +132,11 @@ preface_timeout_infinity(Config) -> env => #{dispatch => cowboy_router:compile(init_routes(Config))}, preface_timeout => infinity }, - {ok, Pid} = cowboy:start_clear(name(), [{port, 0}], ProtoOpts), - Ref = erlang:monitor(process, Pid), + {ok, _} = cowboy:start_clear(name(), [{port, 0}], ProtoOpts), Port = ranch:get_port(name()), - {ok, _} = do_handshake([{port, Port}|Config]), + {ok, Socket} = do_handshake([{port, Port}|Config]), + Pid = get_remote_pid_tcp(Socket), + Ref = erlang:monitor(process, Pid), receive {'DOWN', Ref, process, Pid, Reason} -> error(Reason) @@ -166,10 +168,11 @@ settings_timeout_infinity(Config) -> env => #{dispatch => cowboy_router:compile(init_routes(Config))}, settings_timeout => infinity }, - {ok, Pid} = cowboy:start_clear(name(), [{port, 0}], ProtoOpts), - Ref = erlang:monitor(process, Pid), + {ok, _} = cowboy:start_clear(name(), [{port, 0}], ProtoOpts), Port = ranch:get_port(name()), - {ok, _} = do_handshake([{port, Port}|Config]), + {ok, Socket} = do_handshake([{port, Port}|Config]), + Pid = get_remote_pid_tcp(Socket), + Ref = erlang:monitor(process, Pid), receive {'DOWN', Ref, process, Pid, Reason} -> error(Reason) -- cgit v1.2.3