Skip to content

Commit 412addd

Browse files
committed
rabbitmq_ct_broker_helpers: Use node 2 as the cluster seed node
[Why] When running mixed-version tests, nodes 1/3/5/... are using the primary umbrella, so usually the newest version. Nodes 2/4/6/... are using the secondary umbrella, thus the old version. When clustering, we used to use node 1 (running a new version) as the seed node, meaning other nodes would join it. This complicates things with feature flags because we have to make sure that we start node 1 with new stable feature flags disabled to allow old nodes to join. This is also a problem with Khepri machine versions because the cluster would start with the latest version, which old nodes might not have. [How] This patch changes the logic to use a node running the secondary umbrella as the seed node instead. If there is no node running it, we pick the first node as before.
1 parent a8c8cf2 commit 412addd

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

deps/rabbitmq_ct_helpers/src/rabbit_ct_broker_helpers.erl

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,9 @@ do_start_rabbitmq_node(Config, NodeConfig, I) ->
826826
{ok, _} ->
827827
NodeConfig1 = rabbit_ct_helpers:set_config(
828828
NodeConfig,
829-
[{effective_srcdir, SrcDir},
829+
[{use_secondary_umbrella,
830+
UseSecondaryUmbrella},
831+
{effective_srcdir, SrcDir},
830832
{make_vars_for_node_startup, MakeVars}]),
831833
query_node(Config, NodeConfig1);
832834
_ ->
@@ -936,13 +938,33 @@ maybe_cluster_nodes(Config) ->
936938
end.
937939

938940
cluster_nodes(Config) ->
939-
[NodeConfig1 | NodeConfigs] = get_node_configs(Config),
940-
cluster_nodes1(Config, NodeConfig1, NodeConfigs).
941+
Nodenames = get_node_configs(Config, nodename),
942+
cluster_nodes(Config, Nodenames).
941943

942944
cluster_nodes(Config, Nodes) ->
943-
[NodeConfig1 | NodeConfigs] = [
944-
get_node_config(Config, Node) || Node <- Nodes],
945-
cluster_nodes1(Config, NodeConfig1, NodeConfigs).
945+
NodeConfigs = [get_node_config(Config, Node) || Node <- Nodes],
946+
Search = lists:search(
947+
fun(NodeConfig) ->
948+
rabbit_ct_helpers:get_config(
949+
NodeConfig, use_secondary_umbrella, false)
950+
end, NodeConfigs),
951+
case Search of
952+
{value, SecNodeConfig} ->
953+
NodeConfigs1 = NodeConfigs -- [SecNodeConfig],
954+
Nodename = ?config(nodename, SecNodeConfig),
955+
ct:pal(
956+
"Using secondary-umbrella-based node ~s as the cluster seed "
957+
"node",
958+
[Nodename]),
959+
cluster_nodes1(Config, SecNodeConfig, NodeConfigs1);
960+
false ->
961+
[NodeConfig | NodeConfigs1] = NodeConfigs,
962+
Nodename = ?config(nodename, NodeConfig),
963+
ct:pal(
964+
"Using node ~s as the cluster seed node",
965+
[Nodename]),
966+
cluster_nodes1(Config, NodeConfig, NodeConfigs1)
967+
end.
946968

947969
cluster_nodes1(Config, NodeConfig1, [NodeConfig2 | Rest]) ->
948970
case cluster_nodes(Config, NodeConfig2, NodeConfig1) of

0 commit comments

Comments
 (0)