From 9a8e76a75cb8b1e31adc0c1be0adfa9e110cccca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sat, 28 Mar 2020 15:35:03 +0100 Subject: 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. --- test/flow_SUITE.erl | 10 +++++----- 1 file 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), -- cgit v1.2.3