aboutsummaryrefslogtreecommitdiffstats
path: root/test/http2_SUITE.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-11-21 10:25:01 +0100
committerLoïc Hoguin <[email protected]>2018-11-21 10:25:01 +0100
commitdc240adc1edf70d9d4aad101ae9d40acdacff3c2 (patch)
tree970be5a0b86a5e76e2b009f021a8ef004f406ef8 /test/http2_SUITE.erl
parent9e852b4dd2bf8dc8e31359fe9a1f4601168fd6fb (diff)
downloadcowboy-dc240adc1edf70d9d4aad101ae9d40acdacff3c2.tar.gz
cowboy-dc240adc1edf70d9d4aad101ae9d40acdacff3c2.tar.bz2
cowboy-dc240adc1edf70d9d4aad101ae9d40acdacff3c2.zip
Move some tests out of the old HTTP test suite
And additional minor tweaks.
Diffstat (limited to 'test/http2_SUITE.erl')
-rw-r--r--test/http2_SUITE.erl25
1 files changed, 12 insertions, 13 deletions
diff --git a/test/http2_SUITE.erl b/test/http2_SUITE.erl
index 54a5c98..3af837b 100644
--- a/test/http2_SUITE.erl
+++ b/test/http2_SUITE.erl
@@ -25,13 +25,12 @@ all() -> [{group, clear}].
groups() -> [{clear, [parallel], ct_helper:all(?MODULE)}].
-init_routes(_) -> [
- {"localhost", [
+init_dispatch(_) ->
+ cowboy_router:compile([{"localhost", [
{"/", hello_h, []},
{"/echo/:key", echo_h, []},
{"/resp_iolist_body", resp_iolist_body_h, []}
- ]}
-].
+ ]}]).
%% Do a prior knowledge handshake (function originally copied from rfc7540_SUITE).
do_handshake(Config) ->
@@ -53,7 +52,7 @@ do_handshake(Settings, Config) ->
idle_timeout(Config) ->
doc("Terminate when the idle timeout is reached."),
ProtoOpts = #{
- env => #{dispatch => cowboy_router:compile(init_routes(Config))},
+ env => #{dispatch => init_dispatch(Config)},
idle_timeout => 1000
},
{ok, _} = cowboy:start_clear(?FUNCTION_NAME, [{port, 0}], ProtoOpts),
@@ -70,7 +69,7 @@ idle_timeout(Config) ->
idle_timeout_infinity(Config) ->
doc("Ensure the idle_timeout option accepts the infinity value."),
ProtoOpts = #{
- env => #{dispatch => cowboy_router:compile(init_routes(Config))},
+ env => #{dispatch => init_dispatch(Config)},
idle_timeout => infinity
},
{ok, _} = cowboy:start_clear(?FUNCTION_NAME, [{port, 0}], ProtoOpts),
@@ -87,7 +86,7 @@ idle_timeout_infinity(Config) ->
idle_timeout_reset_on_data(Config) ->
doc("Terminate when the idle timeout is reached."),
ProtoOpts = #{
- env => #{dispatch => cowboy_router:compile(init_routes(Config))},
+ env => #{dispatch => init_dispatch(Config)},
idle_timeout => 1000
},
{ok, _} = cowboy:start_clear(?FUNCTION_NAME, [{port, 0}], ProtoOpts),
@@ -116,7 +115,7 @@ idle_timeout_reset_on_data(Config) ->
inactivity_timeout(Config) ->
doc("Terminate when the inactivity timeout is reached."),
ProtoOpts = #{
- env => #{dispatch => cowboy_router:compile(init_routes(Config))},
+ env => #{dispatch => init_dispatch(Config)},
inactivity_timeout => 1000
},
{ok, _} = cowboy:start_clear(?FUNCTION_NAME, [{port, 0}], ProtoOpts),
@@ -135,7 +134,7 @@ initial_connection_window_size(Config) ->
"connection window is larger than the default."),
ConfiguredSize = 100000,
ProtoOpts = #{
- env => #{dispatch => cowboy_router:compile(init_routes(Config))},
+ env => #{dispatch => init_dispatch(Config)},
initial_connection_window_size => ConfiguredSize
},
{ok, _} = cowboy:start_clear(?FUNCTION_NAME, [{port, 0}], ProtoOpts),
@@ -159,7 +158,7 @@ max_frame_size_sent(Config) ->
"by the max_frame_size_sent configuration value."),
MaxFrameSize = 20000,
ProtoOpts = #{
- env => #{dispatch => cowboy_router:compile(init_routes(Config))},
+ env => #{dispatch => init_dispatch(Config)},
max_frame_size_sent => MaxFrameSize
},
{ok, _} = cowboy:start_clear(?FUNCTION_NAME, [{port, 0}], ProtoOpts),
@@ -200,7 +199,7 @@ max_frame_size_sent(Config) ->
preface_timeout_infinity(Config) ->
doc("Ensure infinity for preface_timeout is accepted."),
ProtoOpts = #{
- env => #{dispatch => cowboy_router:compile(init_routes(Config))},
+ env => #{dispatch => init_dispatch(Config)},
preface_timeout => infinity
},
{ok, _} = cowboy:start_clear(?FUNCTION_NAME, [{port, 0}], ProtoOpts),
@@ -224,7 +223,7 @@ resp_iolist_body(Config) ->
"include improper lists, empty lists and empty binaries. "
"The original issue failed to split the body into frames properly."),
ProtoOpts = #{
- env => #{dispatch => cowboy_router:compile(init_routes(Config))}
+ env => #{dispatch => init_dispatch(Config)}
},
{ok, _} = cowboy:start_clear(?FUNCTION_NAME, [{port, 0}], ProtoOpts),
Port = ranch:get_port(?FUNCTION_NAME),
@@ -244,7 +243,7 @@ resp_iolist_body(Config) ->
settings_timeout_infinity(Config) ->
doc("Ensure infinity for settings_timeout is accepted."),
ProtoOpts = #{
- env => #{dispatch => cowboy_router:compile(init_routes(Config))},
+ env => #{dispatch => init_dispatch(Config)},
settings_timeout => infinity
},
{ok, _} = cowboy:start_clear(?FUNCTION_NAME, [{port, 0}], ProtoOpts),