summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2020-04-06 17:21:33 +0200
committerLuke Bakken <lbakken@pivotal.io>2020-04-06 15:52:03 +0000
commit3a405bea3b2254b9c12231d39c92620d46b3d366 (patch)
treeda3a5d5d039459a974d06bac3fa4fa07c57e7fa8
parent02b2343566cd76197af7e01d80e0acad7bdb0fc6 (diff)
downloadrabbitmq-server-git-3a405bea3b2254b9c12231d39c92620d46b3d366.tar.gz
peer_discovery_classic_config_SUITE: Handle dead-locks
... when nodes are waiting for each other to finish Mnesia initialization. So if the success condition is not met, we reset and restart all nodes except the first one to trigger peer discovery again. We check the success condition after that.
-rw-r--r--test/peer_discovery_classic_config_SUITE.erl44
1 files changed, 38 insertions, 6 deletions
diff --git a/test/peer_discovery_classic_config_SUITE.erl b/test/peer_discovery_classic_config_SUITE.erl
index d1c79ec923..997a3af134 100644
--- a/test/peer_discovery_classic_config_SUITE.erl
+++ b/test/peer_discovery_classic_config_SUITE.erl
@@ -21,8 +21,7 @@
-include_lib("eunit/include/eunit.hrl").
-import(rabbit_ct_broker_helpers, [
- stop_node/2, reset_node/1, start_node/2,
- rewrite_node_config_file/2, cluster_members_online/2
+ cluster_members_online/2
]).
-compile(export_all).
@@ -160,16 +159,49 @@ successful_discovery(Config) ->
3 =:= length(cluster_members_online(Config, 0)) andalso
3 =:= length(cluster_members_online(Config, 1))
end,
- rabbit_ct_helpers:await_condition(Condition, 90000).
+ try
+ rabbit_ct_helpers:await_condition(Condition, 30000)
+ catch
+ exit:{test_case_failed, _} ->
+ ct:pal(
+ ?LOW_IMPORTANCE,
+ "Possible dead-lock; resetting/restarting nodes 2 and 3"),
+ reset_and_restart_node(Config, 1),
+ reset_and_restart_node(Config, 2),
+ rabbit_ct_helpers:await_condition(Condition, 30000)
+ end.
successful_discovery_with_a_subset_of_nodes_coming_online(Config) ->
Condition = fun() ->
2 =:= length(cluster_members_online(Config, 0)) andalso
2 =:= length(cluster_members_online(Config, 1))
end,
- rabbit_ct_helpers:await_condition(Condition, 90000).
+ try
+ rabbit_ct_helpers:await_condition(Condition, 30000)
+ catch
+ exit:{test_case_failed, _} ->
+ ct:pal(
+ ?LOW_IMPORTANCE,
+ "Possible dead-lock; resetting/restarting node 2"),
+ reset_and_restart_node(Config, 1),
+ rabbit_ct_helpers:await_condition(Condition, 30000)
+ end.
no_nodes_configured(Config) ->
Condition = fun() -> length(cluster_members_online(Config, 0)) < 2 end,
- rabbit_ct_helpers:await_condition(Condition, 10000).
-
+ try
+ rabbit_ct_helpers:await_condition(Condition, 10000)
+ catch
+ exit:{test_case_failed, _} ->
+ ct:pal(
+ ?LOW_IMPORTANCE,
+ "Possible dead-lock; resetting/restarting node 2"),
+ reset_and_restart_node(Config, 1),
+ rabbit_ct_helpers:await_condition(Condition, 10000)
+ end.
+
+reset_and_restart_node(Config, I) when is_integer(I) andalso I >= 0 ->
+ Name = rabbit_ct_broker_helpers:get_node_config(Config, I, nodename),
+ rabbit_control_helper:command(stop_app, Name),
+ rabbit_ct_broker_helpers:reset_node(Config, Name),
+ rabbit_control_helper:command(start_app, Name).