aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-11-22 12:18:00 +0100
committerLoïc Hoguin <[email protected]>2018-11-22 12:18:00 +0100
commit6f1a541fa2e1540d9be045f5cde45fd8523a56d5 (patch)
treec64817cca75cbc6494bf15bcd453e626f0857f33
parent3f5af49cfd74f2e5dafacd3dfbf3eb7fa6634f0d (diff)
downloadcowboy-6f1a541fa2e1540d9be045f5cde45fd8523a56d5.tar.gz
cowboy-6f1a541fa2e1540d9be045f5cde45fd8523a56d5.tar.bz2
cowboy-6f1a541fa2e1540d9be045f5cde45fd8523a56d5.zip
Improve the reliability of some http_SUITE tests
-rw-r--r--test/http_SUITE.erl17
1 files changed, 10 insertions, 7 deletions
diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl
index a9a00d1..7f23da4 100644
--- a/test/http_SUITE.erl
+++ b/test/http_SUITE.erl
@@ -228,17 +228,17 @@ idle_timeout_infinity(Config) ->
doc("Ensure the idle_timeout option accepts the infinity value."),
{ok, _} = cowboy:start_clear(?FUNCTION_NAME, [{port, 0}], #{
env => #{dispatch => init_dispatch(Config)},
- request_timeout => 500,
idle_timeout => infinity
}),
Port = ranch:get_port(?FUNCTION_NAME),
try
ConnPid = gun_open([{type, tcp}, {protocol, http}, {port, Port}|Config]),
{ok, http} = gun:await_up(ConnPid),
- _ = gun:post(ConnPid, "/echo/read_body",
- [{<<"content-type">>, <<"text/plain">>}]),
+ timer:sleep(500),
#{socket := Socket} = gun:info(ConnPid),
Pid = get_remote_pid_tcp(Socket),
+ _ = gun:post(ConnPid, "/echo/read_body",
+ [{<<"content-type">>, <<"text/plain">>}]),
Ref = erlang:monitor(process, Pid),
receive
{'DOWN', Ref, process, Pid, Reason} ->
@@ -260,6 +260,7 @@ request_timeout_infinity(Config) ->
try
ConnPid = gun_open([{type, tcp}, {protocol, http}, {port, Port}|Config]),
{ok, http} = gun:await_up(ConnPid),
+ timer:sleep(500),
#{socket := Socket} = gun:info(ConnPid),
Pid = get_remote_pid_tcp(Socket),
Ref = erlang:monitor(process, Pid),
@@ -340,10 +341,11 @@ set_options_idle_timeout(Config) ->
try
ConnPid = gun_open([{type, tcp}, {protocol, http}, {port, Port}|Config]),
{ok, http} = gun:await_up(ConnPid),
- _ = gun:post(ConnPid, "/set_options/idle_timeout_short",
- [{<<"content-type">>, <<"text/plain">>}]),
+ timer:sleep(500),
#{socket := Socket} = gun:info(ConnPid),
Pid = get_remote_pid_tcp(Socket),
+ _ = gun:post(ConnPid, "/set_options/idle_timeout_short",
+ [{<<"content-type">>, <<"text/plain">>}]),
Ref = erlang:monitor(process, Pid),
receive
{'DOWN', Ref, process, Pid, _} ->
@@ -366,10 +368,11 @@ set_options_idle_timeout_only_applies_to_current_request(Config) ->
try
ConnPid = gun_open([{type, tcp}, {protocol, http}, {port, Port}|Config]),
{ok, http} = gun:await_up(ConnPid),
- StreamRef = gun:post(ConnPid, "/set_options/idle_timeout_long",
- [{<<"content-type">>, <<"text/plain">>}]),
+ timer:sleep(500),
#{socket := Socket} = gun:info(ConnPid),
Pid = get_remote_pid_tcp(Socket),
+ StreamRef = gun:post(ConnPid, "/set_options/idle_timeout_long",
+ [{<<"content-type">>, <<"text/plain">>}]),
Ref = erlang:monitor(process, Pid),
receive
{'DOWN', Ref, process, Pid, Reason} ->