aboutsummaryrefslogtreecommitdiffstats
path: root/test/cowboy_test.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-04-22 22:50:45 +0200
committerLoïc Hoguin <[email protected]>2014-04-22 22:50:45 +0200
commit25a17a259056f8343f042553f9a0394309c9d928 (patch)
treed39c924f023196b350ef5ba89c50082d3948e465 /test/cowboy_test.erl
parentb377eb9805de1fc3de0e1d0f1a448505409e9644 (diff)
downloadcowboy-25a17a259056f8343f042553f9a0394309c9d928.tar.gz
cowboy-25a17a259056f8343f042553f9a0394309c9d928.tar.bz2
cowboy-25a17a259056f8343f042553f9a0394309c9d928.zip
Move listener initialization to cowboy_test
Diffstat (limited to 'test/cowboy_test.erl')
-rw-r--r--test/cowboy_test.erl28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/cowboy_test.erl b/test/cowboy_test.erl
index 786eab6..4cb2a33 100644
--- a/test/cowboy_test.erl
+++ b/test/cowboy_test.erl
@@ -49,6 +49,34 @@ all(Suite) ->
string:substr(atom_to_list(F), 1, 3) =/= "do_"
]).
+%% Listeners initialization.
+
+init_http(Ref, ProtoOpts, Config) ->
+ {ok, _} = cowboy:start_http(Ref, 100, [{port, 0}], [
+ {max_keepalive, 50},
+ {timeout, 500}
+ |ProtoOpts]),
+ Port = ranch:get_port(Ref),
+ [{type, tcp}, {port, Port}, {opts, []}|Config].
+
+init_https(Ref, ProtoOpts, Config) ->
+ {_, Cert, Key} = ct_helper:make_certs(),
+ Opts = [{cert, Cert}, {key, Key}],
+ {ok, _} = cowboy:start_https(Ref, 100, Opts ++ [{port, 0}], [
+ {max_keepalive, 50},
+ {timeout, 500}
+ |ProtoOpts]),
+ Port = ranch:get_port(Ref),
+ [{type, ssl}, {port, Port}, {opts, Opts}|Config].
+
+init_spdy(Ref, ProtoOpts, Config) ->
+ {_, Cert, Key} = ct_helper:make_certs(),
+ Opts = [{cert, Cert}, {key, Key}],
+ {ok, _} = cowboy:start_spdy(Ref, 100, Opts ++ [{port, 0}],
+ ProtoOpts),
+ Port = ranch:get_port(Ref),
+ [{type, ssl}, {port, Port}, {opts, Opts}|Config].
+
%% Support functions for testing using Gun.
gun_open(Config) ->