diff options
author | Loïc Hoguin <[email protected]> | 2020-03-28 15:35:03 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2020-03-28 15:35:03 +0100 |
commit | 9a8e76a75cb8b1e31adc0c1be0adfa9e110cccca (patch) | |
tree | aeaec8c8cf2ebd6752a121bb88edbda40101f5ce | |
parent | df741e7107f53bb2275b1948de9599185b26205b (diff) | |
download | gun-9a8e76a75cb8b1e31adc0c1be0adfa9e110cccca.tar.gz gun-9a8e76a75cb8b1e31adc0c1be0adfa9e110cccca.tar.bz2 gun-9a8e76a75cb8b1e31adc0c1be0adfa9e110cccca.zip |
Improve the flow_SUITE:flow_ws test case
Make sure we don't queue too much on the socket because in
that case Gun will just consume everything it's already got.
-rw-r--r-- | test/flow_SUITE.erl | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/flow_SUITE.erl b/test/flow_SUITE.erl index 9050706..feb5b2e 100644 --- a/test/flow_SUITE.erl +++ b/test/flow_SUITE.erl @@ -184,18 +184,18 @@ flow_ws(_) -> %% Gun handles them in separate Protocol:handle calls. Frame = {text, <<"Hello!">>}, gun:ws_send(ConnPid, Frame), - timer:sleep(100), + timer:sleep(500), gun:ws_send(ConnPid, Frame), %% We set the flow to 1 therefore we will receive 1 data message, %% and then nothing because Gun doesn't read from the socket. {ws, _} = gun:await(ConnPid, StreamRef), {error, timeout} = gun:await(ConnPid, StreamRef, 3000), - %% We send 2 more frames. + %% We then update the flow, send 2 frames with some time in between + %% and get 2 more data messages but no more. + gun:update_flow(ConnPid, StreamRef, 2), gun:ws_send(ConnPid, Frame), - timer:sleep(100), + timer:sleep(500), gun:ws_send(ConnPid, Frame), - %% We then update the flow and get 2 more data messages but no more. - gun:update_flow(ConnPid, StreamRef, 2), {ws, _} = gun:await(ConnPid, StreamRef), {ws, _} = gun:await(ConnPid, StreamRef), {error, timeout} = gun:await(ConnPid, StreamRef, 1000), |