mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
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.
This commit is contained in:
parent
e4f1c332a3
commit
a89732e8e0
2 changed files with 1102 additions and 0 deletions
23
test/handlers/long_polling_sys_h.erl
Normal file
23
test/handlers/long_polling_sys_h.erl
Normal file
|
@ -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.
|
1079
test/sys_SUITE.erl
Normal file
1079
test/sys_SUITE.erl
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue