mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Wait for the connection to be up in a few tests
This commit is contained in:
parent
d12e0b55dc
commit
ff674fe6e8
1 changed files with 4 additions and 0 deletions
|
@ -107,6 +107,7 @@ idle_timeout_infinity(Config) ->
|
||||||
Port = ranch:get_port(?FUNCTION_NAME),
|
Port = ranch:get_port(?FUNCTION_NAME),
|
||||||
try
|
try
|
||||||
ConnPid = gun_open([{type, tcp}, {protocol, http}, {port, Port}|Config]),
|
ConnPid = gun_open([{type, tcp}, {protocol, http}, {port, Port}|Config]),
|
||||||
|
{ok, http} = gun:await_up(ConnPid),
|
||||||
_ = gun:post(ConnPid, "/echo/read_body",
|
_ = gun:post(ConnPid, "/echo/read_body",
|
||||||
[{<<"content-type">>, <<"text/plain">>}]),
|
[{<<"content-type">>, <<"text/plain">>}]),
|
||||||
#{socket := Socket} = gun:info(ConnPid),
|
#{socket := Socket} = gun:info(ConnPid),
|
||||||
|
@ -131,6 +132,7 @@ request_timeout_infinity(Config) ->
|
||||||
Port = ranch:get_port(?FUNCTION_NAME),
|
Port = ranch:get_port(?FUNCTION_NAME),
|
||||||
try
|
try
|
||||||
ConnPid = gun_open([{type, tcp}, {protocol, http}, {port, Port}|Config]),
|
ConnPid = gun_open([{type, tcp}, {protocol, http}, {port, Port}|Config]),
|
||||||
|
{ok, http} = gun:await_up(ConnPid),
|
||||||
#{socket := Socket} = gun:info(ConnPid),
|
#{socket := Socket} = gun:info(ConnPid),
|
||||||
Pid = get_remote_pid_tcp(Socket),
|
Pid = get_remote_pid_tcp(Socket),
|
||||||
Ref = erlang:monitor(process, Pid),
|
Ref = erlang:monitor(process, Pid),
|
||||||
|
@ -208,6 +210,7 @@ set_options_idle_timeout(Config) ->
|
||||||
Port = ranch:get_port(?FUNCTION_NAME),
|
Port = ranch:get_port(?FUNCTION_NAME),
|
||||||
try
|
try
|
||||||
ConnPid = gun_open([{type, tcp}, {protocol, http}, {port, Port}|Config]),
|
ConnPid = gun_open([{type, tcp}, {protocol, http}, {port, Port}|Config]),
|
||||||
|
{ok, http} = gun:await_up(ConnPid),
|
||||||
_ = gun:post(ConnPid, "/set_options/idle_timeout_short",
|
_ = gun:post(ConnPid, "/set_options/idle_timeout_short",
|
||||||
[{<<"content-type">>, <<"text/plain">>}]),
|
[{<<"content-type">>, <<"text/plain">>}]),
|
||||||
#{socket := Socket} = gun:info(ConnPid),
|
#{socket := Socket} = gun:info(ConnPid),
|
||||||
|
@ -233,6 +236,7 @@ set_options_idle_timeout_only_applies_to_current_request(Config) ->
|
||||||
Port = ranch:get_port(?FUNCTION_NAME),
|
Port = ranch:get_port(?FUNCTION_NAME),
|
||||||
try
|
try
|
||||||
ConnPid = gun_open([{type, tcp}, {protocol, http}, {port, Port}|Config]),
|
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",
|
StreamRef = gun:post(ConnPid, "/set_options/idle_timeout_long",
|
||||||
[{<<"content-type">>, <<"text/plain">>}]),
|
[{<<"content-type">>, <<"text/plain">>}]),
|
||||||
#{socket := Socket} = gun:info(ConnPid),
|
#{socket := Socket} = gun:info(ConnPid),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue