0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Fix the infinity timeout tests

Make sure the test fails when the code is incorrect.
This commit is contained in:
Loïc Hoguin 2018-08-13 11:09:24 +02:00
parent b0774f7069
commit ef426e0ff4
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
2 changed files with 23 additions and 13 deletions

View file

@ -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)