diff options
Diffstat (limited to 'test/gun_SUITE.erl')
-rw-r--r-- | test/gun_SUITE.erl | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/test/gun_SUITE.erl b/test/gun_SUITE.erl index 3d3734b..0beee43 100644 --- a/test/gun_SUITE.erl +++ b/test/gun_SUITE.erl @@ -90,94 +90,6 @@ do_timeout(Opt, Timeout) -> gun:close(Pid) end. -detect_owner_down(_) -> - {ok, ListenSocket} = gen_tcp:listen(0, [binary, {active, false}]), - {ok, {_, Port}} = inet:sockname(ListenSocket), - Self = self(), - spawn(fun() -> - {ok, ConnPid} = gun:open("localhost", Port), - Self ! {conn, ConnPid}, - gun:await_up(ConnPid), - timer:sleep(100) - end), - {ok, _} = gen_tcp:accept(ListenSocket, 5000), - Pid = receive - {conn, C} -> - C - after 1000 -> - error(timeout) - end, - Ref = monitor(process, Pid), - receive - {'DOWN', Ref, process, Pid, normal} -> - ok - after 1000 -> - true = erlang:is_process_alive(Pid), - error(timeout) - end. - -detect_owner_down_unexpected(_) -> - {ok, ListenSocket} = gen_tcp:listen(0, [binary, {active, false}]), - {ok, {_, Port}} = inet:sockname(ListenSocket), - Self = self(), - spawn(fun() -> - {ok, ConnPid} = gun:open("localhost", Port), - Self ! {conn, ConnPid}, - gun:await_up(ConnPid), - timer:sleep(100), - exit(unexpected) - end), - {ok, _} = gen_tcp:accept(ListenSocket, 5000), - Pid = receive - {conn, C} -> - C - after 1000 -> - error(timeout) - end, - Ref = monitor(process, Pid), - receive - {'DOWN', Ref, process, Pid, {shutdown, {owner_down, unexpected}}} -> - ok - after 1000 -> - true = erlang:is_process_alive(Pid), - error(timeout) - end. - -detect_owner_down_ws(_) -> - Name = name(), - {ok, _} = cowboy:start_clear(Name, [], #{env => #{ - dispatch => cowboy_router:compile([{'_', [{"/", ws_echo_h, []}]}]) - }}), - Port = ranch:get_port(Name), - Self = self(), - spawn(fun() -> - {ok, ConnPid} = gun:open("localhost", Port), - Self ! {conn, ConnPid}, - gun:await_up(ConnPid), - gun:ws_upgrade(ConnPid, "/", []), - receive - {gun_upgrade, ConnPid, _, [<<"websocket">>], _} -> - ok - after 1000 -> - error(timeout) - end - end), - Pid = receive - {conn, C} -> - C - after 1000 -> - error(timeout) - end, - Ref = monitor(process, Pid), - receive - {'DOWN', Ref, process, Pid, normal} -> - ok - after 1000 -> - true = erlang:is_process_alive(Pid), - error(timeout) - end, - cowboy:stop_listener(Name). - ignore_empty_data_http(_) -> doc("When gun:data/4 is called with nofin and empty data, it must be ignored."), {ok, OriginPid, OriginPort} = init_origin(tcp, http), |