summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2014-02-10 21:41:36 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2014-02-10 21:41:36 +0000
commit35d03c54e2eaa15bd472d4a64638f467d5aff298 (patch)
tree764f74df7a7be0f63f7b39ea1a9949096c457923
parent86f42d904a8a9b6cfdc65379e471d48f5ad714f6 (diff)
downloadrabbitmq-server-35d03c54e2eaa15bd472d4a64638f467d5aff298.tar.gz
fix tests
-rw-r--r--src/mirrored_supervisor_tests.erl19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/mirrored_supervisor_tests.erl b/src/mirrored_supervisor_tests.erl
index 780ef11d..6d7c55dd 100644
--- a/src/mirrored_supervisor_tests.erl
+++ b/src/mirrored_supervisor_tests.erl
@@ -175,14 +175,14 @@ test_start_idempotence() ->
test_unsupported() ->
try
- ?MS:start_link({global, foo}, get_group(group), ?MODULE,
+ ?MS:start_link({global, foo}, get_group(group), fun tx_fun/1, ?MODULE,
{sup, one_for_one, []}),
exit(no_global)
catch error:badarg ->
ok
end,
try
- ?MS:start_link({local, foo}, get_group(group), ?MODULE,
+ ?MS:start_link({local, foo}, get_group(group), fun tx_fun/1, ?MODULE,
{sup, simple_one_for_one, []}),
exit(no_sofo)
catch error:badarg ->
@@ -192,7 +192,7 @@ test_unsupported() ->
%% Just test we don't blow up
test_ignore() ->
- ?MS:start_link({local, foo}, get_group(group), ?MODULE,
+ ?MS:start_link({local, foo}, get_group(group), fun tx_fun/1, ?MODULE,
{sup, fake_strategy_for_ignore, []}),
passed.
@@ -202,7 +202,7 @@ test_startup_failure() ->
test_startup_failure(Fail) ->
process_flag(trap_exit, true),
- ?MS:start_link(get_group(group), ?MODULE,
+ ?MS:start_link(get_group(group), fun tx_fun/1, ?MODULE,
{sup, one_for_one, [childspec(Fail)]}),
receive
{'EXIT', _, shutdown} ->
@@ -236,10 +236,11 @@ start_sup(Name, Group) ->
start_sup({Name, []}, Group).
start_sup0(anon, Group, ChildSpecs) ->
- ?MS:start_link(Group, ?MODULE, {sup, one_for_one, ChildSpecs});
+ ?MS:start_link(Group, fun tx_fun/1, ?MODULE,
+ {sup, one_for_one, ChildSpecs});
start_sup0(Name, Group, ChildSpecs) ->
- ?MS:start_link({local, Name}, Group, ?MODULE,
+ ?MS:start_link({local, Name}, Group, fun tx_fun/1, ?MODULE,
{sup, one_for_one, ChildSpecs}).
childspec(Id) ->
@@ -258,6 +259,12 @@ pid_of(Id) ->
{received, Pid, ping} = call(Id, ping),
Pid.
+tx_fun(Fun) ->
+ case mnesia:sync_transaction(Fun) of
+ {atomic, Result} -> Result;
+ {aborted, Reason} -> throw({error, Reason})
+ end.
+
inc_group() ->
Count = case get(counter) of
undefined -> 0;