diff options
Diffstat (limited to 'test/cowboy_test.erl')
-rw-r--r-- | test/cowboy_test.erl | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/test/cowboy_test.erl b/test/cowboy_test.erl index 670da18..541e8f9 100644 --- a/test/cowboy_test.erl +++ b/test/cowboy_test.erl @@ -1,4 +1,4 @@ -%% Copyright (c) 2014-2024, Loïc Hoguin <[email protected]> +%% Copyright (c) Loïc Hoguin <[email protected]> %% %% Permission to use, copy, modify, and/or distribute this software for any %% purpose with or without fee is hereby granted, provided that the above @@ -120,50 +120,53 @@ common_groups(Tests, Parallel) -> Groups end. -init_common_groups(Name = http, Config, Mod) -> - init_http(Name, #{ +init_common_groups(Name, Config, Mod) -> + init_common_groups(Name, Config, Mod, #{}). + +init_common_groups(Name = http, Config, Mod, ProtoOpts) -> + init_http(Name, ProtoOpts#{ env => #{dispatch => Mod:init_dispatch(Config)} }, [{flavor, vanilla}|Config]); -init_common_groups(Name = https, Config, Mod) -> - init_https(Name, #{ +init_common_groups(Name = https, Config, Mod, ProtoOpts) -> + init_https(Name, ProtoOpts#{ env => #{dispatch => Mod:init_dispatch(Config)} }, [{flavor, vanilla}|Config]); -init_common_groups(Name = h2, Config, Mod) -> - init_http2(Name, #{ +init_common_groups(Name = h2, Config, Mod, ProtoOpts) -> + init_http2(Name, ProtoOpts#{ env => #{dispatch => Mod:init_dispatch(Config)} }, [{flavor, vanilla}|Config]); -init_common_groups(Name = h2c, Config, Mod) -> - Config1 = init_http(Name, #{ +init_common_groups(Name = h2c, Config, Mod, ProtoOpts) -> + Config1 = init_http(Name, ProtoOpts#{ env => #{dispatch => Mod:init_dispatch(Config)} }, [{flavor, vanilla}|Config]), lists:keyreplace(protocol, 1, Config1, {protocol, http2}); -init_common_groups(Name = h3, Config, Mod) -> - init_http3(Name, #{ +init_common_groups(Name = h3, Config, Mod, ProtoOpts) -> + init_http3(Name, ProtoOpts#{ env => #{dispatch => Mod:init_dispatch(Config)} }, [{flavor, vanilla}|Config]); -init_common_groups(Name = http_compress, Config, Mod) -> - init_http(Name, #{ +init_common_groups(Name = http_compress, Config, Mod, ProtoOpts) -> + init_http(Name, ProtoOpts#{ env => #{dispatch => Mod:init_dispatch(Config)}, stream_handlers => [cowboy_compress_h, cowboy_stream_h] }, [{flavor, compress}|Config]); -init_common_groups(Name = https_compress, Config, Mod) -> - init_https(Name, #{ +init_common_groups(Name = https_compress, Config, Mod, ProtoOpts) -> + init_https(Name, ProtoOpts#{ env => #{dispatch => Mod:init_dispatch(Config)}, stream_handlers => [cowboy_compress_h, cowboy_stream_h] }, [{flavor, compress}|Config]); -init_common_groups(Name = h2_compress, Config, Mod) -> - init_http2(Name, #{ +init_common_groups(Name = h2_compress, Config, Mod, ProtoOpts) -> + init_http2(Name, ProtoOpts#{ env => #{dispatch => Mod:init_dispatch(Config)}, stream_handlers => [cowboy_compress_h, cowboy_stream_h] }, [{flavor, compress}|Config]); -init_common_groups(Name = h2c_compress, Config, Mod) -> - Config1 = init_http(Name, #{ +init_common_groups(Name = h2c_compress, Config, Mod, ProtoOpts) -> + Config1 = init_http(Name, ProtoOpts#{ env => #{dispatch => Mod:init_dispatch(Config)}, stream_handlers => [cowboy_compress_h, cowboy_stream_h] }, [{flavor, compress}|Config]), lists:keyreplace(protocol, 1, Config1, {protocol, http2}); -init_common_groups(Name = h3_compress, Config, Mod) -> - init_http3(Name, #{ +init_common_groups(Name = h3_compress, Config, Mod, ProtoOpts) -> + init_http3(Name, ProtoOpts#{ env => #{dispatch => Mod:init_dispatch(Config)}, stream_handlers => [cowboy_compress_h, cowboy_stream_h] }, [{flavor, compress}|Config]). |