mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Fix tests for most recent Gun
This commit is contained in:
parent
b2b5e3a01a
commit
7867e435fe
2 changed files with 7 additions and 7 deletions
|
@ -436,23 +436,23 @@ websocket(Config) ->
|
||||||
{ok, Pid} = gun:open("127.0.0.1", 8080, #{protocols => [http], retry => 0}),
|
{ok, Pid} = gun:open("127.0.0.1", 8080, #{protocols => [http], retry => 0}),
|
||||||
{ok, http} = gun:await_up(Pid),
|
{ok, http} = gun:await_up(Pid),
|
||||||
_ = monitor(process, Pid),
|
_ = monitor(process, Pid),
|
||||||
gun:ws_upgrade(Pid, "/websocket", [], #{compress => true}),
|
StreamRef = gun:ws_upgrade(Pid, "/websocket", [], #{compress => true}),
|
||||||
receive
|
receive
|
||||||
{gun_ws_upgrade, Pid, ok, _} ->
|
{gun_upgrade, Pid, StreamRef, _, _} ->
|
||||||
ok;
|
ok;
|
||||||
Msg1 ->
|
Msg1 ->
|
||||||
exit({connection_failed, Msg1})
|
exit({connection_failed, Msg1})
|
||||||
end,
|
end,
|
||||||
%% Check that we receive the message sent on timer on init.
|
%% Check that we receive the message sent on timer on init.
|
||||||
receive
|
receive
|
||||||
{gun_ws, Pid, {text, <<"Hello!">>}} ->
|
{gun_ws, Pid, StreamRef, {text, <<"Hello!">>}} ->
|
||||||
ok
|
ok
|
||||||
after 2000 ->
|
after 2000 ->
|
||||||
exit(timeout)
|
exit(timeout)
|
||||||
end,
|
end,
|
||||||
%% Check that we receive subsequent messages sent on timer.
|
%% Check that we receive subsequent messages sent on timer.
|
||||||
receive
|
receive
|
||||||
{gun_ws, Pid, {text, <<"How' you doin'?">>}} ->
|
{gun_ws, Pid, StreamRef, {text, <<"How' you doin'?">>}} ->
|
||||||
ok
|
ok
|
||||||
after 2000 ->
|
after 2000 ->
|
||||||
exit(timeout)
|
exit(timeout)
|
||||||
|
@ -460,7 +460,7 @@ websocket(Config) ->
|
||||||
%% Check that we receive the echoed message.
|
%% Check that we receive the echoed message.
|
||||||
gun:ws_send(Pid, {text, <<"hello">>}),
|
gun:ws_send(Pid, {text, <<"hello">>}),
|
||||||
receive
|
receive
|
||||||
{gun_ws, Pid, {text, <<"That's what she said! hello">>}} ->
|
{gun_ws, Pid, StreamRef, {text, <<"That's what she said! hello">>}} ->
|
||||||
ok
|
ok
|
||||||
after 500 ->
|
after 500 ->
|
||||||
exit(timeout)
|
exit(timeout)
|
||||||
|
|
|
@ -371,7 +371,7 @@ do_ws(Config) ->
|
||||||
doc("Confirm metrics are correct when switching to Websocket."),
|
doc("Confirm metrics are correct when switching to Websocket."),
|
||||||
ConnPid = gun_open(Config),
|
ConnPid = gun_open(Config),
|
||||||
{ok, http} = gun:await_up(ConnPid),
|
{ok, http} = gun:await_up(ConnPid),
|
||||||
gun:ws_upgrade(ConnPid, "/ws_echo", [
|
StreamRef = gun:ws_upgrade(ConnPid, "/ws_echo", [
|
||||||
{<<"accept-encoding">>, <<"gzip">>},
|
{<<"accept-encoding">>, <<"gzip">>},
|
||||||
{<<"x-test-pid">>, pid_to_list(self())}
|
{<<"x-test-pid">>, pid_to_list(self())}
|
||||||
]),
|
]),
|
||||||
|
@ -428,7 +428,7 @@ do_ws(Config) ->
|
||||||
end,
|
end,
|
||||||
%% And of course the upgrade completed successfully after that.
|
%% And of course the upgrade completed successfully after that.
|
||||||
receive
|
receive
|
||||||
{gun_ws_upgrade, ConnPid, ok, _} ->
|
{gun_upgrade, ConnPid, StreamRef, _, _} ->
|
||||||
ok
|
ok
|
||||||
after 1000 ->
|
after 1000 ->
|
||||||
error(timeout)
|
error(timeout)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue