diff options
author | Loïc Hoguin <[email protected]> | 2023-01-23 11:51:43 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2023-01-23 11:52:00 +0100 |
commit | 9c0be0639f6e41b680580adf02920b8c79b79f7b (patch) | |
tree | bde28973eb3f0bc6fcd1da63659c7c0c7ca79ca4 /test/ws_SUITE.erl | |
parent | ffa04a5019c0f09fb057c2c35bbaad979e36f9c5 (diff) | |
download | gun-9c0be0639f6e41b680580adf02920b8c79b79f7b.tar.gz gun-9c0be0639f6e41b680580adf02920b8c79b79f7b.tar.bz2 gun-9c0be0639f6e41b680580adf02920b8c79b79f7b.zip |
Selective receive in test to avoid receiving wrong message
Diffstat (limited to 'test/ws_SUITE.erl')
-rw-r--r-- | test/ws_SUITE.erl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test/ws_SUITE.erl b/test/ws_SUITE.erl index 709eb89..06f1e93 100644 --- a/test/ws_SUITE.erl +++ b/test/ws_SUITE.erl @@ -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), |