Skip to content

Commit d60b3a7

Browse files
authored
Merge pull request #13377 from rabbitmq/backport-test-fixes-from-main
Backport test fixes from `main`
2 parents e98d8aa + 6a4e0dc commit d60b3a7

File tree

9 files changed

+90
-37
lines changed

9 files changed

+90
-37
lines changed

.github/workflows/test-make-target.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ jobs:
9090
- name: RUN TESTS
9191
if: inputs.plugin != 'rabbitmq_cli'
9292
run: |
93+
sudo netstat -ntp
9394
make -C deps/${{ inputs.plugin }} ${{ inputs.make_target }} RABBITMQ_METADATA_STORE=${{ inputs.metadata_store }}
9495
9596
# rabbitmq_cli needs a correct broker version for two of its tests.

deps/rabbit/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,10 @@ define ct_master.erl
241241
peer:call(Pid2, net_kernel, set_net_ticktime, [5]),
242242
peer:call(Pid3, net_kernel, set_net_ticktime, [5]),
243243
peer:call(Pid4, net_kernel, set_net_ticktime, [5]),
244-
peer:call(Pid1, persistent_term, put, [rabbit_ct_tcp_port_base, 23000]),
245-
peer:call(Pid2, persistent_term, put, [rabbit_ct_tcp_port_base, 25000]),
246-
peer:call(Pid3, persistent_term, put, [rabbit_ct_tcp_port_base, 27000]),
247-
peer:call(Pid4, persistent_term, put, [rabbit_ct_tcp_port_base, 29000]),
244+
peer:call(Pid1, persistent_term, put, [rabbit_ct_tcp_port_base, 16000]),
245+
peer:call(Pid2, persistent_term, put, [rabbit_ct_tcp_port_base, 20000]),
246+
peer:call(Pid3, persistent_term, put, [rabbit_ct_tcp_port_base, 24000]),
247+
peer:call(Pid4, persistent_term, put, [rabbit_ct_tcp_port_base, 28000]),
248248
[{[_], {ok, Results}}] = ct_master_fork:run("$1"),
249249
peer:stop(Pid4),
250250
peer:stop(Pid3),

deps/rabbit/test/amqp_auth_SUITE.erl

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,17 @@ init_per_group(Group, Config0) ->
120120
Config1,
121121
rabbit_ct_broker_helpers:setup_steps() ++
122122
rabbit_ct_client_helpers:setup_steps()),
123-
Vhost = <<"test vhost">>,
124-
User = <<"test user">>,
125-
ok = rabbit_ct_broker_helpers:add_vhost(Config, Vhost),
126-
ok = rabbit_ct_broker_helpers:add_user(Config, User),
127-
[{test_vhost, Vhost},
128-
{test_user, User}] ++ Config.
123+
case Config of
124+
_ when is_list(Config) ->
125+
Vhost = <<"test vhost">>,
126+
User = <<"test user">>,
127+
ok = rabbit_ct_broker_helpers:add_vhost(Config, Vhost),
128+
ok = rabbit_ct_broker_helpers:add_user(Config, User),
129+
[{test_vhost, Vhost},
130+
{test_user, User}] ++ Config;
131+
{skip, _} = Skip ->
132+
Skip
133+
end.
129134

130135
end_per_group(_Group, Config) ->
131136
ok = rabbit_ct_broker_helpers:delete_user(Config, ?config(test_user, Config)),

deps/rabbit/test/clustering_management_SUITE.erl

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ groups() ->
7676
status_with_alarm,
7777
pid_file_and_await_node_startup_in_khepri,
7878
await_running_count_in_khepri,
79-
start_with_invalid_schema_in_path,
8079
persistent_cluster_id,
8180
stop_start_cluster_node,
8281
restart_cluster_node,
@@ -337,7 +336,7 @@ restart_cluster_node(Config) ->
337336
assert_clustered([Rabbit, Hare]).
338337

339338
join_and_part_cluster_in_khepri(Config) ->
340-
[Rabbit, Hare, Bunny] = cluster_members(Config),
339+
[Rabbit, Bunny, Hare] = cluster_members(Config),
341340
assert_not_clustered(Rabbit),
342341
assert_not_clustered(Hare),
343342
assert_not_clustered(Bunny),
@@ -447,38 +446,38 @@ join_to_start_interval(Config) ->
447446
assert_clustered([Rabbit, Hare]).
448447

449448
join_cluster_in_minority(Config) ->
450-
[Rabbit, Hare, Bunny] = cluster_members(Config),
449+
[Rabbit, Bunny, Hare] = cluster_members(Config),
451450
assert_not_clustered(Rabbit),
452451
assert_not_clustered(Hare),
453452
assert_not_clustered(Bunny),
454453

455-
stop_join_start(Config, Bunny, Rabbit),
454+
stop_join_start(Config, Rabbit, Bunny),
456455
assert_clustered([Rabbit, Bunny]),
457-
ok = rabbit_ct_broker_helpers:stop_node(Config, Bunny),
456+
ok = rabbit_ct_broker_helpers:stop_node(Config, Rabbit),
458457

459458
ok = stop_app(Config, Hare),
460-
?assertEqual(ok, join_cluster(Config, Hare, Rabbit, false)),
459+
?assertEqual(ok, join_cluster(Config, Hare, Bunny, false)),
461460

462-
ok = rabbit_ct_broker_helpers:start_node(Config, Bunny),
461+
ok = rabbit_ct_broker_helpers:start_node(Config, Rabbit),
463462
?assertEqual(ok, join_cluster(Config, Hare, Rabbit, false)),
464463
?assertEqual(ok, start_app(Config, Hare)),
465464

466465
assert_clustered([Rabbit, Bunny, Hare]).
467466

468467
join_cluster_with_rabbit_stopped(Config) ->
469-
[Rabbit, Hare, Bunny] = cluster_members(Config),
468+
[Rabbit, Bunny, Hare] = cluster_members(Config),
470469
assert_not_clustered(Rabbit),
471470
assert_not_clustered(Hare),
472471
assert_not_clustered(Bunny),
473472

474-
stop_join_start(Config, Bunny, Rabbit),
473+
stop_join_start(Config, Rabbit, Bunny),
475474
assert_clustered([Rabbit, Bunny]),
476-
ok = stop_app(Config, Bunny),
475+
ok = stop_app(Config, Rabbit),
477476

478477
ok = stop_app(Config, Hare),
479-
?assertEqual(ok, join_cluster(Config, Hare, Rabbit, false)),
478+
?assertEqual(ok, join_cluster(Config, Hare, Bunny, false)),
480479

481-
ok = start_app(Config, Bunny),
480+
ok = start_app(Config, Rabbit),
482481
?assertEqual(ok, join_cluster(Config, Hare, Rabbit, false)),
483482
?assertEqual(ok, start_app(Config, Hare)),
484483

@@ -1119,7 +1118,7 @@ await_running_count_in_khepri(Config) ->
11191118
await_running_count, [5, 1000])).
11201119

11211120
start_nodes_in_reverse_order(Config) ->
1122-
[Rabbit, Hare, Bunny] = cluster_members(Config),
1121+
[Rabbit, Bunny, Hare] = cluster_members(Config),
11231122
assert_not_clustered(Rabbit),
11241123
assert_not_clustered(Hare),
11251124
assert_not_clustered(Bunny),
@@ -1142,7 +1141,7 @@ start_nodes_in_reverse_order(Config) ->
11421141

11431142
%% Test booting nodes in the wrong order for Mnesia. Interesting...
11441143
start_nodes_in_stop_order(Config) ->
1145-
[Rabbit, Hare, Bunny] = cluster_members(Config),
1144+
[Rabbit, Bunny, Hare] = cluster_members(Config),
11461145
assert_not_clustered(Rabbit),
11471146
assert_not_clustered(Hare),
11481147
assert_not_clustered(Bunny),
@@ -1167,7 +1166,7 @@ start_nodes_in_stop_order(Config) ->
11671166
end.
11681167

11691168
start_nodes_in_stop_order_in_khepri(Config) ->
1170-
[Rabbit, Hare, Bunny] = cluster_members(Config),
1169+
[Rabbit, Bunny, Hare] = cluster_members(Config),
11711170
assert_not_clustered(Rabbit),
11721171
assert_not_clustered(Hare),
11731172
assert_not_clustered(Bunny),
@@ -1190,7 +1189,7 @@ start_nodes_in_stop_order_in_khepri(Config) ->
11901189

11911190
%% TODO test force_boot with Khepri involved
11921191
start_nodes_in_stop_order_with_force_boot(Config) ->
1193-
[Rabbit, Hare, Bunny] = cluster_members(Config),
1192+
[Rabbit, Bunny, Hare] = cluster_members(Config),
11941193
assert_not_clustered(Rabbit),
11951194
assert_not_clustered(Hare),
11961195
assert_not_clustered(Bunny),

deps/rabbit/test/rabbit_stream_queue_SUITE.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,13 +1565,13 @@ format(Config) ->
15651565
case length(Nodes) of
15661566
3 ->
15671567
[_, Server2, Server3] = Nodes,
1568-
ok = rabbit_control_helper:command(stop_app, Server2),
15691568
ok = rabbit_control_helper:command(stop_app, Server3),
1569+
ok = rabbit_control_helper:command(stop_app, Server2),
15701570

15711571
Fmt2 = rabbit_ct_broker_helpers:rpc(Config, Server, rabbit_stream_queue,
15721572
?FUNCTION_NAME, [QRecord, #{}]),
1573-
ok = rabbit_control_helper:command(start_app, Server2),
15741573
ok = rabbit_control_helper:command(start_app, Server3),
1574+
ok = rabbit_control_helper:command(start_app, Server2),
15751575
?assertEqual(stream, proplists:get_value(type, Fmt2)),
15761576
?assertEqual(minority, proplists:get_value(state, Fmt2)),
15771577
?assertEqual(Server, proplists:get_value(leader, Fmt2)),
@@ -2743,7 +2743,7 @@ retry_if_coordinator_unavailable(Config, Server, Cmd, Retry) ->
27432743
case re:run(Msg, ".*coordinator_unavailable.*", [{capture, none}]) of
27442744
match ->
27452745
ct:pal("Attempt to execute command ~p failed, coordinator unavailable", [Cmd]),
2746-
retry_if_coordinator_unavailable(Config, Ch, Cmd, Retry - 1);
2746+
retry_if_coordinator_unavailable(Config, Server, Cmd, Retry - 1);
27472747
_ ->
27482748
exit(Error)
27492749
end

deps/rabbit/test/unit_credit_flow_SUITE.erl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
-compile(export_all).
1313

14+
suite() ->
15+
[{timetrap, {minutes, 3}}].
16+
1417
all() ->
1518
[
1619
{group, sequential_tests}

deps/rabbitmq_ct_helpers/src/rabbit_ct_broker_helpers.erl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@
173173
user/1,
174174

175175
configured_metadata_store/1,
176-
await_metadata_store_consistent/2
176+
await_metadata_store_consistent/2,
177+
do_nodes_run_same_ra_machine_version/2
177178
]).
178179

179180
%% Internal functions exported to be used by rpc:call/4.
@@ -1174,6 +1175,12 @@ ra_last_applied(ServerId) ->
11741175
#{last_applied := LastApplied} = ra:key_metrics(ServerId),
11751176
LastApplied.
11761177

1178+
do_nodes_run_same_ra_machine_version(Config, RaMachineMod) ->
1179+
[MacVer1 | MacVerN] = MacVers = rpc_all(Config, RaMachineMod, version, []),
1180+
ct:pal("Ra machine versions of ~s: ~0p", [RaMachineMod, MacVers]),
1181+
is_integer(MacVer1) andalso
1182+
lists:all(fun(MacVer) -> MacVer =:= MacVer1 end, MacVerN).
1183+
11771184
rewrite_node_config_file(Config, Node) ->
11781185
NodeConfig = get_node_config(Config, Node),
11791186
I = if

deps/rabbitmq_peer_discovery_consul/test/system_SUITE.erl

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,27 @@ init_per_testcase(Testcase, Config)
8383
case Config3 of
8484
_ when is_list(Config3) ->
8585
try
86-
_ = rabbit_ct_broker_helpers:rpc_all(
87-
Config3, rabbit_peer_discovery_backend, api_version, []),
88-
Config3
86+
SameMacVer = (
87+
rabbit_ct_broker_helpers:
88+
do_nodes_run_same_ra_machine_version(
89+
Config3, khepri_machine)),
90+
case SameMacVer of
91+
true ->
92+
_ = rabbit_ct_broker_helpers:rpc_all(
93+
Config3,
94+
rabbit_peer_discovery_backend, api_version, []),
95+
Config3;
96+
false ->
97+
Config5 = rabbit_ct_helpers:run_steps(
98+
Config3,
99+
rabbit_ct_client_helpers:teardown_steps()
100+
++
101+
rabbit_ct_broker_helpers:teardown_steps()),
102+
rabbit_ct_helpers:testcase_finished(Config5, Testcase),
103+
{skip,
104+
"Nodes are using different Khepri Ra machine "
105+
"versions; clustering will likely fail"}
106+
end
89107
catch
90108
error:{exception, undef,
91109
[{rabbit_peer_discovery_backend, api_version, _, _}

deps/rabbitmq_peer_discovery_etcd/test/system_SUITE.erl

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,27 @@ init_per_testcase(Testcase, Config)
9292
case Config3 of
9393
_ when is_list(Config3) ->
9494
try
95-
_ = rabbit_ct_broker_helpers:rpc_all(
96-
Config3, rabbit_peer_discovery_backend, api_version, []),
97-
Config3
95+
SameMacVer = (
96+
rabbit_ct_broker_helpers:
97+
do_nodes_run_same_ra_machine_version(
98+
Config3, khepri_machine)),
99+
case SameMacVer of
100+
true ->
101+
_ = rabbit_ct_broker_helpers:rpc_all(
102+
Config3,
103+
rabbit_peer_discovery_backend, api_version, []),
104+
Config3;
105+
false ->
106+
Config5 = rabbit_ct_helpers:run_steps(
107+
Config3,
108+
rabbit_ct_client_helpers:teardown_steps()
109+
++
110+
rabbit_ct_broker_helpers:teardown_steps()),
111+
rabbit_ct_helpers:testcase_finished(Config5, Testcase),
112+
{skip,
113+
"Nodes are using different Khepri Ra machine "
114+
"versions; clustering will likely fail"}
115+
end
98116
catch
99117
error:{exception, undef,
100118
[{rabbit_peer_discovery_backend, api_version, _, _}
@@ -239,7 +257,9 @@ wait_for_etcd(EtcdEndpoints) ->
239257
Timeout = 60000,
240258
rabbit_ct_helpers:await_condition(
241259
fun() ->
242-
case eetcd:open(test, EtcdEndpoints) of
260+
Ret = eetcd:open(test, EtcdEndpoints),
261+
ct:pal("Ret = ~p", [Ret]),
262+
case Ret of
243263
{ok, _Pid} -> true;
244264
_ -> false
245265
end

0 commit comments

Comments
 (0)