0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 20:30:23 +00:00

Increase the period for req_SUITE:read_body_period

This should increase the likelihood of the test succeeding
on slower systems when run over TLS.
This commit is contained in:
Loïc Hoguin 2019-09-15 16:30:09 +02:00
parent ea976f02e0
commit 2888e9e6ef
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764

View file

@ -53,7 +53,7 @@ init_dispatch(Config) ->
{"/crash/:key/period", echo_h, #{length => 999999999, period => 1000, crash => true}}, {"/crash/:key/period", echo_h, #{length => 999999999, period => 1000, crash => true}},
{"/no-opts/:key", echo_h, #{crash => true}}, {"/no-opts/:key", echo_h, #{crash => true}},
{"/opts/:key/length", echo_h, #{length => 1000}}, {"/opts/:key/length", echo_h, #{length => 1000}},
{"/opts/:key/period", echo_h, #{length => 999999999, period => 1000}}, {"/opts/:key/period", echo_h, #{length => 999999999, period => 2000}},
{"/opts/:key/timeout", echo_h, #{timeout => 1000, crash => true}}, {"/opts/:key/timeout", echo_h, #{timeout => 1000, crash => true}},
{"/100-continue/:key", echo_h, []}, {"/100-continue/:key", echo_h, []},
{"/full/:key", echo_h, []}, {"/full/:key", echo_h, []},
@ -461,15 +461,15 @@ read_body_mtu(Config) ->
ok. ok.
read_body_period(Config) -> read_body_period(Config) ->
doc("Read the request body for at most 1 second."), doc("Read the request body for at most 2 seconds."),
ConnPid = gun_open(Config), ConnPid = gun_open(Config),
Body = <<0:8000000>>, Body = <<0:8000000>>,
Ref = gun:headers(ConnPid, "POST", "/opts/read_body/period", [ Ref = gun:headers(ConnPid, "POST", "/opts/read_body/period", [
{<<"content-length">>, integer_to_binary(byte_size(Body) * 2)} {<<"content-length">>, integer_to_binary(byte_size(Body) * 2)}
]), ]),
%% The body is sent twice, first with nofin, then wait 2 seconds, then again with fin. %% The body is sent twice, first with nofin, then wait 3 seconds, then again with fin.
gun:data(ConnPid, Ref, nofin, Body), gun:data(ConnPid, Ref, nofin, Body),
timer:sleep(2000), timer:sleep(3000),
gun:data(ConnPid, Ref, fin, Body), gun:data(ConnPid, Ref, fin, Body),
{response, nofin, 200, _} = gun:await(ConnPid, Ref), {response, nofin, 200, _} = gun:await(ConnPid, Ref),
{ok, Body} = gun:await_body(ConnPid, Ref), {ok, Body} = gun:await_body(ConnPid, Ref),