Skip to content

Commit 532ae82

Browse files
committed
WIP test rolling upgrade of federation mirrored supervisors
1 parent 0c71c1a commit 532ae82

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

deps/rabbitmq_ct_helpers/src/rabbit_ct_broker_helpers.erl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@
167167

168168
enable_plugin/3,
169169
disable_plugin/3,
170+
set_plugins/3,
170171

171172
test_channel/0,
172173
test_writer/1,
@@ -2415,6 +2416,9 @@ enable_plugin(Config, Node, Plugin) ->
24152416
disable_plugin(Config, Node, Plugin) ->
24162417
plugin_action(Config, Node, [disable, Plugin]).
24172418

2419+
set_plugins(Config, Node, PluginList) ->
2420+
plugin_action(Config, Node, [set | PluginList]).
2421+
24182422
plugin_action(Config, Node, Args) ->
24192423
NodeConfig = get_node_config(Config, Node),
24202424
Nodename = ?config(nodename, NodeConfig),

deps/rabbitmq_exchange_federation/test/exchange_SUITE.erl

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -580,14 +580,14 @@ lookup_exchange_status(Config) ->
580580

581581
child_id_format(Config) ->
582582
case rabbit_ct_helpers:is_mixed_versions() of
583-
false ->
583+
true ->
584584
[UpstreamNode,
585585
OldNodeA,
586586
NewNodeB,
587587
OldNodeC,
588588
NewNodeD] = rabbit_ct_broker_helpers:get_node_configs(
589589
Config, nodename),
590-
590+
591591
%% Create a cluster with the nodes running the old version of RabbitMQ in
592592
%% mixed-version testing.
593593
%%
@@ -603,7 +603,12 @@ child_id_format(Config) ->
603603
%% secondary umbrella, `NewNodeB' the primary copy, and so on.
604604
Config1 = rabbit_ct_broker_helpers:cluster_nodes(
605605
Config, [OldNodeA, OldNodeC]),
606-
606+
607+
%% The old nodes get the "rabbitmq_exchange_federation" plugin enabled but that is not found
608+
%% Let's switch to the old plugin name
609+
[rabbit_ct_broker_helpers:set_plugins(Config, Node, ["rabbitmq_federation"])
610+
|| Node <- [OldNodeA, OldNodeC]],
611+
607612
%% Prepare the whole federated exchange on that old cluster.
608613
UpstreamName = <<"fed_on_upgrade">>,
609614
rabbit_ct_broker_helpers:set_parameter(
@@ -637,9 +642,17 @@ child_id_format(Config) ->
637642
case Id of
638643
%% This is the format we expect everywhere.
639644
#exchange{name = #resource{name = XName}} ->
645+
ct:pal("first checking old nodes"),
640646
%% Verify that the supervisors exist on all nodes.
641647
lists:foreach(
642648
fun(Node) ->
649+
ct:pal("fed on old node ~p", [Node]),
650+
651+
rabbit_ct_broker_helpers:rpc(
652+
Config1, Node,
653+
supervisor, which_children,
654+
[rabbit_federation_sup]),
655+
643656
?assertMatch(
644657
[{#exchange{name = #resource{name = XName}},
645658
_, _, _}],
@@ -656,14 +669,24 @@ child_id_format(Config) ->
656669
%% After that, the supervisors run on the new code.
657670
Config2 = rabbit_ct_broker_helpers:cluster_nodes(
658671
Config1, OldNodeA, [NewNodeB, NewNodeD]),
672+
673+
%% Re-enable rabbit_exchange_federation plugin on
674+
%% the new nodes. They got reset when joining the
675+
%% cluster
676+
[rabbit_ct_broker_helpers:set_plugins(Config, Node, ["rabbitmq_exchange_federation"])
677+
|| Node <- [NewNodeB, NewNodeD]],
678+
659679
ok = rabbit_ct_broker_helpers:stop_broker(Config2, OldNodeA),
660680
ok = rabbit_ct_broker_helpers:reset_node(Config1, OldNodeA),
661681
ok = rabbit_ct_broker_helpers:stop_broker(Config2, OldNodeC),
662682
ok = rabbit_ct_broker_helpers:reset_node(Config2, OldNodeC),
663683

684+
664685
%% Verify that the supervisors still use the same IDs.
665686
lists:foreach(
666687
fun(Node) ->
688+
ct:pal("new node ~p", [Node]),
689+
667690
?assertMatch(
668691
[{#exchange{name = #resource{name = XName}},
669692
_, _, _}],
@@ -691,7 +714,7 @@ child_id_format(Config) ->
691714
when is_list(List) ->
692715
{skip, "Testcase skipped with the transiently changed ID format"}
693716
end;
694-
true ->
717+
false ->
695718
%% skip the test in mixed version mode
696719
{skip, "Should not run in mixed version environments"}
697720
end.

0 commit comments

Comments
 (0)