From 4d5174632cc1feac541697b18e6fbbdd0eed021b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 23 Mar 2018 18:33:16 +0100 Subject: Add initial support for system messages in cowboy_loop --- test/handlers/long_polling_sys_h.erl | 4 ++-- test/sys_SUITE.erl | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/handlers/long_polling_sys_h.erl b/test/handlers/long_polling_sys_h.erl index 7745d8c..8f85758 100644 --- a/test/handlers/long_polling_sys_h.erl +++ b/test/handlers/long_polling_sys_h.erl @@ -10,7 +10,7 @@ init(Req, _) -> process_flag(trap_exit, true), erlang:send_after(500, self(), timeout), - {cowboy_loop, Req, undefined, hibernate}. + {cowboy_loop, Req, undefined}. info(timeout, Req, State) -> %% Send an unused status code to make sure there's no @@ -19,5 +19,5 @@ info(timeout, Req, State) -> info(_, Req, State) -> {ok, Req, State}. -terminate({crash, _, _}, _, _) -> +terminate(_, _, _) -> ok. diff --git a/test/sys_SUITE.erl b/test/sys_SUITE.erl index 6a460bf..bb77ede 100644 --- a/test/sys_SUITE.erl +++ b/test/sys_SUITE.erl @@ -400,9 +400,8 @@ trap_exit_parent_exit_loop(Config) -> Parent = do_get_remote_pid_tcp(Socket), [{_, Pid, _, _}] = supervisor:which_children(Parent), Pid ! {'EXIT', Parent, shutdown}, - %% We're getting a 500 because the process exited in an unexpected way - %% from Cowboy's point of view. - {ok, "HTTP/1.1 500 "} = gen_tcp:recv(Socket, 13, 1000), + %% We exit normally but didn't send a response. + {ok, "HTTP/1.1 204 "} = gen_tcp:recv(Socket, 13, 1000), false = is_process_alive(Pid), ok. @@ -483,7 +482,7 @@ trap_exit_other_exit_loop(Config) -> timer:sleep(100), Parent = do_get_remote_pid_tcp(Socket), [{_, Pid, _, _}] = supervisor:which_children(Parent), - Pid ! {'EXIT', Parent, shutdown}, + Pid ! {'EXIT', self(), shutdown}, %% The process stays alive. {ok, "HTTP/1.1 299 "} = gen_tcp:recv(Socket, 13, 1000), true = is_process_alive(Pid), -- cgit v1.2.3