aboutsummaryrefslogtreecommitdiffstats
path: root/test/gun_SUITE.erl
diff options
context:
space:
mode:
Diffstat (limited to 'test/gun_SUITE.erl')
-rw-r--r--test/gun_SUITE.erl17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/gun_SUITE.erl b/test/gun_SUITE.erl
index cb2c262..a7bb0f1 100644
--- a/test/gun_SUITE.erl
+++ b/test/gun_SUITE.erl
@@ -18,6 +18,7 @@
-import(ct_helper, [doc/1]).
-import(ct_helper, [name/0]).
+-import(gun_test, [init_origin/3]).
all() ->
ct_helper:all(?MODULE).
@@ -227,6 +228,22 @@ retry_1(_) ->
error(timeout)
end.
+retry_immediately(_) ->
+ doc("Ensure Gun retries immediately."),
+ %% We have to make a first successful connection in order to test this.
+ {ok, _, OriginPort} = init_origin(tcp, http,
+ fun(_, ClientSocket, ClientTransport) ->
+ ClientTransport:close(ClientSocket)
+ end),
+ {ok, Pid} = gun:open("localhost", OriginPort, #{retry => 1, retry_timeout => 500}),
+ Ref = monitor(process, Pid),
+ receive
+ {'DOWN', Ref, process, Pid, {shutdown, _}} ->
+ ok
+ after 200 ->
+ error(timeout)
+ end.
+
retry_timeout(_) ->
doc("Ensure the retry_timeout value is enforced."),
{ok, Pid} = gun:open("localhost", 12345, #{retry => 1, retry_timeout => 1000}),