aboutsummaryrefslogtreecommitdiffstats
path: root/test/cowboy_test.erl
diff options
context:
space:
mode:
Diffstat (limited to 'test/cowboy_test.erl')
-rw-r--r--test/cowboy_test.erl51
1 files changed, 23 insertions, 28 deletions
diff --git a/test/cowboy_test.erl b/test/cowboy_test.erl
index cced1f9..e3aeb97 100644
--- a/test/cowboy_test.erl
+++ b/test/cowboy_test.erl
@@ -20,21 +20,21 @@
%% Listeners initialization.
init_http(Ref, ProtoOpts, Config) ->
- {ok, _} = cowboy:start_http(Ref, 100, [{port, 0}], ProtoOpts),
+ {ok, _} = cowboy:start_clear(Ref, 100, [{port, 0}], ProtoOpts),
Port = ranch:get_port(Ref),
- [{type, tcp}, {port, Port}, {opts, []}|Config].
+ [{type, tcp}, {protocol, http}, {port, Port}, {opts, []}|Config].
init_https(Ref, ProtoOpts, Config) ->
Opts = ct_helper:get_certs_from_ets(),
- {ok, _} = cowboy:start_https(Ref, 100, Opts ++ [{port, 0}], ProtoOpts),
+ {ok, _} = cowboy:start_tls(Ref, 100, Opts ++ [{port, 0}], ProtoOpts),
Port = ranch:get_port(Ref),
- [{type, ssl}, {port, Port}, {opts, Opts}|Config].
+ [{type, ssl}, {protocol, http}, {port, Port}, {opts, Opts}|Config].
init_spdy(Ref, ProtoOpts, Config) ->
Opts = ct_helper:get_certs_from_ets(),
- {ok, _} = cowboy:start_spdy(Ref, 100, Opts ++ [{port, 0}], ProtoOpts),
+ {ok, _} = cowboy:start_tls(Ref, 100, Opts ++ [{port, 0}], ProtoOpts),
Port = ranch:get_port(Ref),
- [{type, ssl}, {port, Port}, {opts, Opts}|Config].
+ [{type, ssl}, {protocol, spdy}, {port, Port}, {opts, Opts}|Config].
%% Common group of listeners used by most suites.
@@ -59,32 +59,26 @@ common_groups(Tests) ->
].
init_common_groups(Name = http, Config, Mod) ->
- init_http(Name, [
- {env, [{dispatch, Mod:init_dispatch(Config)}]}
- ], Config);
+ init_http(Name, #{env => #{dispatch => Mod:init_dispatch(Config)}}, Config);
init_common_groups(Name = https, Config, Mod) ->
- init_https(Name, [
- {env, [{dispatch, Mod:init_dispatch(Config)}]}
- ], Config);
+ init_https(Name, #{env => #{dispatch => Mod:init_dispatch(Config)}}, Config);
init_common_groups(Name = spdy, Config, Mod) ->
- init_spdy(Name, [
- {env, [{dispatch, Mod:init_dispatch(Config)}]}
- ], Config);
+ init_https(Name, #{env => #{dispatch => Mod:init_dispatch(Config)}}, Config);
init_common_groups(Name = http_compress, Config, Mod) ->
- init_http(Name, [
- {env, [{dispatch, Mod:init_dispatch(Config)}]},
- {compress, true}
- ], Config);
+ init_http(Name, #{
+ env => #{dispatch => Mod:init_dispatch(Config)},
+ compress => true
+ }, Config);
init_common_groups(Name = https_compress, Config, Mod) ->
- init_https(Name, [
- {env, [{dispatch, Mod:init_dispatch(Config)}]},
- {compress, true}
- ], Config);
+ init_https(Name, #{
+ env => #{dispatch => Mod:init_dispatch(Config)},
+ compress => true
+ }, Config);
init_common_groups(Name = spdy_compress, Config, Mod) ->
- init_spdy(Name, [
- {env, [{dispatch, Mod:init_dispatch(Config)}]},
- {compress, true}
- ], Config).
+ init_spdy(Name, #{
+ env => #{dispatch => Mod:init_dispatch(Config)},
+ compress => true
+ }, Config).
%% Support functions for testing using Gun.
@@ -94,7 +88,8 @@ gun_open(Config) ->
gun_open(Config, Opts) ->
{ok, ConnPid} = gun:open("localhost", config(port, Config), Opts#{
retry => 0,
- transport => config(type, Config)
+ transport => config(type, Config),
+ protocols => [config(protocol, Config)]
}),
ConnPid.