summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrancesco Mazzoli <francesco@rabbitmq.com>2012-05-29 11:48:03 +0100
committerFrancesco Mazzoli <francesco@rabbitmq.com>2012-05-29 11:48:03 +0100
commit9c2c1ed3703860eb55836eac2ee3d28881b570b5 (patch)
treecce58f027ff035372cbb37098cea206c11762415 /src
parentb476416eb490d453560491060f34d264a00c4e11 (diff)
downloadrabbitmq-server-9c2c1ed3703860eb55836eac2ee3d28881b570b5.tar.gz
set up cluster beforehand in tests
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_tests.erl46
1 files changed, 33 insertions, 13 deletions
diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl
index 31706d46..001544f4 100644
--- a/src/rabbit_tests.erl
+++ b/src/rabbit_tests.erl
@@ -31,6 +31,7 @@
-define(CLEANUP_QUEUE_NAME, <<"cleanup-queue">>).
all_tests() ->
+ ok = setup_cluster(),
passed = gm_tests:all_tests(),
passed = mirrored_supervisor_tests:all_tests(),
application:set_env(rabbit, file_handles_high_watermark, 10, infinity),
@@ -55,28 +56,47 @@ all_tests() ->
passed = test_runtime_parameters(),
passed = test_server_status(),
passed = test_confirms(),
- passed = maybe_run_cluster_dependent_tests(),
+ passed =
+ do_if_secondary_node(
+ fun run_cluster_dependent_tests/1,
+ fun (SecondaryNode) ->
+ io:format("Skipping cluster dependent tests with node ~p~n",
+ [SecondaryNode]),
+ passed
+ end),
passed = test_configurable_server_properties(),
passed.
-maybe_run_cluster_dependent_tests() ->
+do_if_secondary_node(Up, Down) ->
SecondaryNode = rabbit_nodes:make("hare"),
case net_adm:ping(SecondaryNode) of
- pong -> passed = run_cluster_dependent_tests(SecondaryNode);
- pang -> io:format("Skipping cluster dependent tests with node ~p~n",
- [SecondaryNode])
- end,
- passed.
+ pong -> Up(SecondaryNode);
+ pang -> Down(SecondaryNode)
+ end.
-run_cluster_dependent_tests(SecondaryNode) ->
- SecondaryNodeS = atom_to_list(SecondaryNode),
+setup_cluster() ->
+ do_if_secondary_node(
+ fun (SecondaryNode) ->
+ ok = control_action(stop_app, []),
+ ok = control_action(join_cluster,
+ [atom_to_list(SecondaryNode)]),
+ ok = control_action(start_app, []),
+ ok = control_action(start_app, SecondaryNode, [], [])
+ end,
+ fun (_) -> ok end).
- ok = control_action(stop_app, []),
- ok = control_action(join_cluster, [SecondaryNodeS]),
- ok = control_action(start_app, []),
- ok = control_action(start_app, SecondaryNode, [], []),
+maybe_run_cluster_dependent_tests() ->
+ do_if_secondary_node(
+ fun (SecondaryNode) ->
+ passed = run_cluster_dependent_tests(SecondaryNode)
+ end,
+ fun (SecondaryNode) ->
+ io:format("Skipping cluster dependent tests with node ~p~n",
+ [SecondaryNode])
+ end).
+run_cluster_dependent_tests(SecondaryNode) ->
io:format("Running cluster dependent tests with node ~p~n", [SecondaryNode]),
passed = test_delegates_async(SecondaryNode),
passed = test_delegates_sync(SecondaryNode),