diff options
author | Loïc Hoguin <[email protected]> | 2018-03-07 18:27:19 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-03-12 16:52:02 +0100 |
commit | a89732e8e0fac2b2265007a11c05d4d0f6e6b1b0 (patch) | |
tree | edd3a0c1248df23f3b65900d4164abcc7b4db5e1 /test/handlers | |
parent | e4f1c332a3027b236ad07b25ffb033a11b195855 (diff) | |
download | cowboy-a89732e8e0fac2b2265007a11c05d4d0f6e6b1b0.tar.gz cowboy-a89732e8e0fac2b2265007a11c05d4d0f6e6b1b0.tar.bz2 cowboy-a89732e8e0fac2b2265007a11c05d4d0f6e6b1b0.zip |
Initial work on the sys_SUITE
There's already tests failing and quite some refactoring to be
done to make some things easier to test or fix issues.
Diffstat (limited to 'test/handlers')
-rw-r--r-- | test/handlers/long_polling_sys_h.erl | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/handlers/long_polling_sys_h.erl b/test/handlers/long_polling_sys_h.erl new file mode 100644 index 0000000..7745d8c --- /dev/null +++ b/test/handlers/long_polling_sys_h.erl @@ -0,0 +1,23 @@ +%% This module implements a loop handler that does nothing +%% and expects a crash to happen. + +-module(long_polling_sys_h). + +-export([init/2]). +-export([info/3]). +-export([terminate/3]). + +init(Req, _) -> + process_flag(trap_exit, true), + erlang:send_after(500, self(), timeout), + {cowboy_loop, Req, undefined, hibernate}. + +info(timeout, Req, State) -> + %% Send an unused status code to make sure there's no + %% conflict with whatever Cowboy may send itself. + {ok, cowboy_req:reply(<<"299 OK!">>, Req), State}; +info(_, Req, State) -> + {ok, Req, State}. + +terminate({crash, _, _}, _, _) -> + ok. |