summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2014-02-10 21:43:59 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2014-02-10 21:43:59 +0000
commit6fa897cc4c8629b62673f81be06e073ed4e45e23 (patch)
tree26acd9e110d8fedfa08a14ffec36e29100036638
parent599fd29739378fe09b80317221daec709a0e5aea (diff)
parentf48570b11ce9fc11efb9c80dd1dd558cd7c79ec4 (diff)
downloadrabbitmq-server-bug25853.tar.gz
merge default into bug25853bug25853
since the previous merge pulled in a breakage
-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;