diff options
Diffstat (limited to 'test/stream_handler_SUITE.erl')
-rw-r--r-- | test/stream_handler_SUITE.erl | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/test/stream_handler_SUITE.erl b/test/stream_handler_SUITE.erl index 0021ab9..c821b38 100644 --- a/test/stream_handler_SUITE.erl +++ b/test/stream_handler_SUITE.erl @@ -29,29 +29,46 @@ all() -> groups() -> cowboy_test:common_groups(ct_helper:all(?MODULE)). +%% We set this module as a logger in order to silence expected errors. init_per_group(Name = http, Config) -> - cowboy_test:init_http(Name, #{stream_handlers => [stream_handler_h]}, Config); + cowboy_test:init_http(Name, #{ + logger => ?MODULE, + stream_handlers => [stream_handler_h] + }, Config); init_per_group(Name = https, Config) -> - cowboy_test:init_https(Name, #{stream_handlers => [stream_handler_h]}, Config); + cowboy_test:init_https(Name, #{ + logger => ?MODULE, + stream_handlers => [stream_handler_h] + }, Config); init_per_group(Name = h2, Config) -> - cowboy_test:init_http2(Name, #{stream_handlers => [stream_handler_h]}, Config); + cowboy_test:init_http2(Name, #{ + logger => ?MODULE, + stream_handlers => [stream_handler_h] + }, Config); init_per_group(Name = h2c, Config) -> - Config1 = cowboy_test:init_http(Name, #{stream_handlers => [stream_handler_h]}, Config), + Config1 = cowboy_test:init_http(Name, #{ + logger => ?MODULE, + stream_handlers => [stream_handler_h] + }, Config), lists:keyreplace(protocol, 1, Config1, {protocol, http2}); init_per_group(Name = http_compress, Config) -> cowboy_test:init_http(Name, #{ + logger => ?MODULE, stream_handlers => [cowboy_compress_h, stream_handler_h] }, Config); init_per_group(Name = https_compress, Config) -> cowboy_test:init_https(Name, #{ + logger => ?MODULE, stream_handlers => [cowboy_compress_h, stream_handler_h] }, Config); init_per_group(Name = h2_compress, Config) -> cowboy_test:init_http2(Name, #{ + logger => ?MODULE, stream_handlers => [cowboy_compress_h, stream_handler_h] }, Config); init_per_group(Name = h2c_compress, Config) -> Config1 = cowboy_test:init_http(Name, #{ + logger => ?MODULE, stream_handlers => [cowboy_compress_h, stream_handler_h] }, Config), lists:keyreplace(protocol, 1, Config1, {protocol, http2}). @@ -59,6 +76,13 @@ init_per_group(Name = h2c_compress, Config) -> end_per_group(Name, _) -> cowboy:stop_listener(Name). +%% Logger function silencing the expected crashes. + +error("Unhandled exception " ++ _, [error, crash|_]) -> + ok; +error(Format, Args) -> + error_logger:error_msg(Format, Args). + %% Tests. crash_in_init(Config) -> |