Skip to content

Commit 0e10b1d

Browse files
dumbbellmergify[bot]
authored andcommitted
cluster_minority_SUITE: Fix race in remove_node_when_seed_node_is_leader
[Why] When node A becomes the leader, it still takes a few exchanges with followers to allow cluster changes again. Concurrently, the testcase blocks traffic between A and other nodes to simulate a network partition. If this happens after A becomes the leader but before cluster changes are permitted again, the testcase will never succeed and will eventually abort with: Case: cluster_minority_SUITE:remove_node_when_seed_node_is_leader Reason: {error, {{awaitMatch, [{module,cluster_minority_SUITE}, {expression, "..."}, {pattern,"ok"}, {value, {error,69,<<"Error:\ncluster_change_not_permitted">>}}]}, [How] Before blocking traffic, we wait for cluster changes to be permitted again on node A. (cherry picked from commit 7166357) # Conflicts: # deps/rabbit/test/cluster_minority_SUITE.erl
1 parent cd705d6 commit 0e10b1d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

deps/rabbit/test/cluster_minority_SUITE.erl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,35 @@ remove_node(Config) ->
311311
rabbit_control_helper:command(start_app, C),
312312

313313
%% Minority partition: A
314+
<<<<<<< HEAD
314315
partition_3_node_cluster(Config),
316+
=======
317+
partition_3_node_cluster(Config1),
318+
319+
Pong = ra:ping(AMember, 10000),
320+
ct:pal("Member A state: ~0p", [Pong]),
321+
case Pong of
322+
{pong, leader} ->
323+
?awaitMatch(
324+
{ok, #{cluster_change_permitted := true}, _},
325+
rabbit_ct_broker_helpers:rpc(Config, A, ra, member_overview, [AMember]),
326+
60000),
327+
?awaitMatch(
328+
ok,
329+
rabbit_control_helper:command(
330+
forget_cluster_node, A, [atom_to_list(B)], []),
331+
60000);
332+
Ret ->
333+
ct:pal("A is not the expected leader: ~p", [Ret]),
334+
{skip, "Node A was not a leader"}
335+
end.
336+
337+
remove_node_when_seed_node_is_follower(Config) ->
338+
[A, B, C | _] = rabbit_ct_broker_helpers:get_node_configs(
339+
Config, nodename),
340+
341+
%% Three node cluster: A, B, C
342+
>>>>>>> 716635742 (cluster_minority_SUITE: Fix race in `remove_node_when_seed_node_is_leader`)
315343
Cluster = [A, B, C],
316344

317345
ok = rabbit_control_helper:command(forget_cluster_node, A, [atom_to_list(B)], []),

0 commit comments

Comments
 (0)