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.erl30
1 files changed, 21 insertions, 9 deletions
diff --git a/test/gun_SUITE.erl b/test/gun_SUITE.erl
index 6afaaf5..6a01cf6 100644
--- a/test/gun_SUITE.erl
+++ b/test/gun_SUITE.erl
@@ -54,18 +54,22 @@ atom_hostname(_) ->
connect_timeout(_) ->
doc("Ensure an integer value for connect_timeout is accepted."),
- {ok, Pid} = gun:open("localhost", 12345, #{connect_timeout => 1000, retry => 0}),
- Ref = monitor(process, Pid),
- receive
- {'DOWN', Ref, process, Pid, {shutdown, _}} ->
- ok
- after 5000 ->
- error(timeout)
- end.
+ do_timeout(connect_timeout, 1000).
connect_timeout_infinity(_) ->
doc("Ensure infinity for connect_timeout is accepted."),
- {ok, Pid} = gun:open("localhost", 12345, #{connect_timeout => infinity, retry => 0}),
+ do_timeout(connect_timeout, infinity).
+
+domain_lookup_timeout(_) ->
+ doc("Ensure an integer value for domain_lookup_timeout is accepted."),
+ do_timeout(domain_lookup_timeout, 1000).
+
+domain_lookup_timeout_infinity(_) ->
+ doc("Ensure infinity for domain_lookup_timeout is accepted."),
+ do_timeout(domain_lookup_timeout, infinity).
+
+do_timeout(Opt, Timeout) ->
+ {ok, Pid} = gun:open("localhost", 12345, #{Opt => Timeout, retry => 0}),
Ref = monitor(process, Pid),
receive
{'DOWN', Ref, process, Pid, {shutdown, _}} ->
@@ -496,6 +500,14 @@ supervise_false(_) ->
[] = [P || {_, P, _, _} <- supervisor:which_children(gun_sup), P =:= Pid],
ok.
+tls_handshake_timeout(_) ->
+ doc("Ensure an integer value for tls_handshake_timeout is accepted."),
+ do_timeout(tls_handshake_timeout, 1000).
+
+tls_handshake_timeout_infinity(_) ->
+ doc("Ensure infinity for tls_handshake_timeout is accepted."),
+ do_timeout(tls_handshake_timeout, infinity).
+
transform_header_name(_) ->
doc("The transform_header_name option allows changing the case of header names."),
{ok, ListenSocket} = gen_tcp:listen(0, [binary, {active, false}]),