aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-11-19 12:37:39 +0100
committerLoïc Hoguin <[email protected]eu>2018-11-19 12:37:39 +0100
commit66fd122c08dd05e2ff2300af963cb977dca2ba7c (patch)
tree81833f01c8659589e9af45f87dde2f101d76e759 /test
parentae96aa6e494d8cb4bf3525ecf7575552d1e6f5e9 (diff)
downloadcowboy-2.6.0.tar.gz
cowboy-2.6.0.tar.bz2
cowboy-2.6.0.zip
Silence expected errors from the stream_handler test suite2.6.0
Diffstat (limited to 'test')
-rw-r--r--test/stream_handler_SUITE.erl32
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) ->