aboutsummaryrefslogtreecommitdiffstats
path: root/test/shutdown_SUITE.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-08-17 16:52:46 +0200
committerLoïc Hoguin <[email protected]>2015-08-17 16:52:46 +0200
commitf5f480c5750b76b662430b62ef85ebceea5aadc6 (patch)
tree17cb06d0e11f571bc625707eeb6f83efe8028b5c /test/shutdown_SUITE.erl
parent5ea28fb44629eb217fee2a1e8fcd0bb47dde1034 (diff)
downloadranch-f5f480c5750b76b662430b62ef85ebceea5aadc6.tar.gz
ranch-f5f480c5750b76b662430b62ef85ebceea5aadc6.tar.bz2
ranch-f5f480c5750b76b662430b62ef85ebceea5aadc6.zip
Beginnings of modernizing the test suite
Merging because I have to do other work but this is still a nice enough improvement.
Diffstat (limited to 'test/shutdown_SUITE.erl')
-rw-r--r--test/shutdown_SUITE.erl36
1 files changed, 8 insertions, 28 deletions
diff --git a/test/shutdown_SUITE.erl b/test/shutdown_SUITE.erl
index 109c381..97963d5 100644
--- a/test/shutdown_SUITE.erl
+++ b/test/shutdown_SUITE.erl
@@ -13,34 +13,14 @@
%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-module(shutdown_SUITE).
+-compile(export_all).
--include_lib("common_test/include/ct.hrl").
-
-%% ct.
--export([all/0]).
--export([init_per_suite/1]).
--export([end_per_suite/1]).
-
-%% Tests.
-
--export([brutal_kill/1]).
--export([infinity/1]).
--export([infinity_trap_exit/1]).
--export([timeout/1]).
--export([timeout_trap_exit/1]).
+-import(ct_helper, [doc/1]).
%% ct.
all() ->
- [brutal_kill, infinity, infinity_trap_exit, timeout, timeout_trap_exit].
-
-init_per_suite(Config) ->
- ok = application:start(ranch),
- Config.
-
-end_per_suite(_) ->
- application:stop(ranch),
- ok.
+ ct_helper:all(?MODULE).
%% Tests.
@@ -57,7 +37,7 @@ brutal_kill(_) ->
= lists:keyfind(ranch_conns_sup, 1, ListenerSupChildren),
[{_, Pid, _, _}] = supervisor:which_children(ConnsSup),
true = is_process_alive(Pid),
- ranch:stop_listener(Name),
+ ok = ranch:stop_listener(Name),
receive after 100 -> ok end,
false = is_process_alive(Pid),
false = is_process_alive(ListenerSup),
@@ -77,7 +57,7 @@ infinity(_) ->
= lists:keyfind(ranch_conns_sup, 1, ListenerSupChildren),
[{_, Pid, _, _}] = supervisor:which_children(ConnsSup),
true = is_process_alive(Pid),
- ranch:stop_listener(Name),
+ ok = ranch:stop_listener(Name),
receive after 100 -> ok end,
false = is_process_alive(Pid),
false = is_process_alive(ListenerSup),
@@ -98,7 +78,7 @@ infinity_trap_exit(_) ->
[{_, Pid, _, _}] = supervisor:which_children(ConnsSup),
true = is_process_alive(Pid),
%% This call will block infinitely.
- SpawnPid = spawn(fun() -> ranch:stop_listener(Name) end),
+ SpawnPid = spawn(fun() -> ok = ranch:stop_listener(Name) end),
receive after 100 -> ok end,
%% The protocol traps exit signals, and ignore them, so it won't die.
true = is_process_alive(Pid),
@@ -127,7 +107,7 @@ timeout(_) ->
= lists:keyfind(ranch_conns_sup, 1, ListenerSupChildren),
[{_, Pid, _, _}] = supervisor:which_children(ConnsSup),
true = is_process_alive(Pid),
- ranch:stop_listener(Name),
+ ok = ranch:stop_listener(Name),
receive after 100 -> ok end,
false = is_process_alive(Pid),
false = is_process_alive(ListenerSup),
@@ -148,7 +128,7 @@ timeout_trap_exit(_) ->
[{_, Pid, _, _}] = supervisor:which_children(ConnsSup),
true = is_process_alive(Pid),
%% This call will block for the duration of the shutdown.
- SpawnPid = spawn(fun() -> ranch:stop_listener(Name) end),
+ SpawnPid = spawn(fun() -> ok = ranch:stop_listener(Name) end),
receive after 100 -> ok end,
%% The protocol traps exit signals, and ignore them, so it won't die.
true = is_process_alive(Pid),