aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-08-11 18:21:02 +0200
committerLoïc Hoguin <[email protected]>2017-08-11 18:21:02 +0200
commit0ffaebff959e5399c7d6fdc8672e32c288d34754 (patch)
tree41733a28dc0cb7c1d3a15cde9a8e7658b767ad62 /test
parent12eae6ef6ce51a7354c13cae0e11bf0f63aa1078 (diff)
downloadgun-0ffaebff959e5399c7d6fdc8672e32c288d34754.tar.gz
gun-0ffaebff959e5399c7d6fdc8672e32c288d34754.tar.bz2
gun-0ffaebff959e5399c7d6fdc8672e32c288d34754.zip
Add missing Websocket clause detecting owner is gone
Diffstat (limited to 'test')
-rw-r--r--test/gun_SUITE.erl29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/gun_SUITE.erl b/test/gun_SUITE.erl
index dbd51b5..842d40c 100644
--- a/test/gun_SUITE.erl
+++ b/test/gun_SUITE.erl
@@ -64,6 +64,35 @@ detect_owner_gone(_) ->
error(timeout)
end.
+detect_owner_gone_ws(_) ->
+ Self = self(),
+ spawn(fun() ->
+ {ok, ConnPid} = gun:open("echo.websocket.org", 80),
+ Self ! {conn, ConnPid},
+ gun:await_up(ConnPid),
+ gun:ws_upgrade(ConnPid, "/", []),
+ receive
+ {gun_ws_upgrade, Pid, ok, _} ->
+ 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, {{owner_gone, _}, _}} ->
+ ok
+ after 1000 ->
+ true = erlang:is_process_alive(Pid),
+ error(timeout)
+ end.
+
gone_reason(_) ->
doc("The last connection failure must be propagated."),
{ok, Pid} = gun:open("localhost", 12345, #{retry => 0}),