aboutsummaryrefslogtreecommitdiffstats
path: root/test/cowboy_ct_hook.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-04-21 21:22:08 +0200
committerLoïc Hoguin <[email protected]>2014-04-21 21:24:43 +0200
commit75218c4be0e9a2b55c871499668ceba56f7e4aa9 (patch)
tree38e9ffaea957ceceb4a48eec7414db29ae787b7c /test/cowboy_ct_hook.erl
parent74512fc84c1e20050f69b3a53d2fc5ef4edbe9dd (diff)
downloadcowboy-75218c4be0e9a2b55c871499668ceba56f7e4aa9.tar.gz
cowboy-75218c4be0e9a2b55c871499668ceba56f7e4aa9.tar.bz2
cowboy-75218c4be0e9a2b55c871499668ceba56f7e4aa9.zip
Silence expected test error reports from the console output
The errors are still logged by common_test to the report it creates. The process that is going to crash has to call cowboy_error_h:ignore/3 with the MFA where the crash is expected to occur for it to be ignored. Gun retry failures are also ignored. Only unexpected crashes are printed.
Diffstat (limited to 'test/cowboy_ct_hook.erl')
-rw-r--r--test/cowboy_ct_hook.erl22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/cowboy_ct_hook.erl b/test/cowboy_ct_hook.erl
new file mode 100644
index 0000000..5eb0587
--- /dev/null
+++ b/test/cowboy_ct_hook.erl
@@ -0,0 +1,22 @@
+%% Copyright (c) 2014, 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
+%% copyright notice and this permission notice appear in all copies.
+%%
+%% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+%% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+%% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+%% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+%% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+%% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+-module(cowboy_ct_hook).
+
+-export([init/2]).
+
+init(_, _) ->
+ error_logger:tty(false),
+ error_logger:add_report_handler(cowboy_error_h),
+ {ok, undefined}.