summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2011-12-01 16:54:54 +0000
committerSimon MacMullen <simon@rabbitmq.com>2011-12-01 16:54:54 +0000
commit18f8352c8fb8f08a8586b89e97f32852be8f937f (patch)
tree7e9a71e1170fc29408a3e652449a05c349d5d10b
parent79a2e2da9bfc918f48b7e6ed92f1f573c4afae8a (diff)
downloadrabbitmq-server-18f8352c8fb8f08a8586b89e97f32852be8f937f.tar.gz
Failing test.
-rw-r--r--src/mirrored_supervisor_tests.erl28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mirrored_supervisor_tests.erl b/src/mirrored_supervisor_tests.erl
index b8d52ae8..0ec50ce8 100644
--- a/src/mirrored_supervisor_tests.erl
+++ b/src/mirrored_supervisor_tests.erl
@@ -197,6 +197,22 @@ test_ignore() ->
{sup, fake_strategy_for_ignore, []}),
passed.
+test_startup_failure() ->
+ [test_startup_failure(F) || F <- [error, exit]],
+ passed.
+
+test_startup_failure(Fail) ->
+ process_flag(trap_exit, true),
+ ?MS:start_link(get_group(group), ?MODULE,
+ {sup, one_for_one, [childspec(Fail)]}),
+ process_flag(trap_exit, false),
+ receive
+ {'EXIT', _, shutdown} ->
+ ok
+ after 1000 ->
+ exit({did_not_exit, Fail})
+ end.
+
%% ---------------------------------------------------------------------------
with_sups(Fun, Sups) ->
@@ -230,6 +246,12 @@ start_sup0(Name, Group, ChildSpecs) ->
childspec(Id) ->
{Id, {?MODULE, start_gs, [Id]}, transient, 16#ffffffff, worker, [?MODULE]}.
+start_gs(error) ->
+ {error, foo};
+
+start_gs(exit) ->
+ {exit, foo};
+
start_gs(Id) ->
gen_server:start_link({local, Id}, ?MODULE, server, []).
@@ -281,6 +303,12 @@ kill_wait(Pid) ->
init({sup, fake_strategy_for_ignore, _ChildSpecs}) ->
ignore;
+init({sup, fake_strategy_for_startup_error, _ChildSpecs}) ->
+ {error, foo};
+
+init({sup, fake_strategy_for_startup_exit, _ChildSpecs}) ->
+ exit(foo);
+
init({sup, Strategy, ChildSpecs}) ->
{ok, {{Strategy, 0, 1}, ChildSpecs}};