Skip to content

Commit

Permalink
Selective receive in test to avoid receiving wrong message
Browse files Browse the repository at this point in the history
  • Loading branch information
essen committed Jan 23, 2023
1 parent ffa04a5 commit 9c0be06
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/ws_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ reply_to(Config) ->
Self = self(),
Frame = {text, <<"Hello!">>},
ReplyTo = spawn(fun() ->
{ConnPid, StreamRef} = receive Msg -> Msg after 1000 -> error(timeout) end,
{ConnPid, StreamRef} = receive
{C, S} when is_pid(C), is_reference(S) -> {C, S}
after 1000 ->
error(timeout)
end,
{upgrade, [<<"websocket">>], _} = gun:await(ConnPid, StreamRef),
Self ! {self(), ready},
{ws, Frame} = gun:await(ConnPid, StreamRef),
Expand Down

0 comments on commit 9c0be06

Please sign in to comment.