Skip to content

Skip peer discovery clustering tests if multiple Khepri machine versions #13248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion deps/rabbitmq_ct_helpers/src/rabbit_ct_broker_helpers.erl
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@
user/1,

configured_metadata_store/1,
await_metadata_store_consistent/2
await_metadata_store_consistent/2,
do_nodes_run_same_ra_machine_version/2
]).

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

do_nodes_run_same_ra_machine_version(Config, RaMachineMod) ->
[MacVer1 | MacVerN] = MacVers = rpc_all(Config, RaMachineMod, version, []),
ct:pal("Ra machine versions of ~s: ~0p", [RaMachineMod, MacVers]),
is_integer(MacVer1) andalso
lists:all(fun(MacVer) -> MacVer =:= MacVer1 end, MacVerN).

rewrite_node_config_file(Config, Node) ->
NodeConfig = get_node_config(Config, Node),
I = if
Expand Down
24 changes: 21 additions & 3 deletions deps/rabbitmq_peer_discovery_consul/test/system_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,27 @@ init_per_testcase(Testcase, Config)
case Config3 of
_ when is_list(Config3) ->
try
_ = rabbit_ct_broker_helpers:rpc_all(
Config3, rabbit_peer_discovery_backend, api_version, []),
Config3
SameMacVer = (
rabbit_ct_broker_helpers:
do_nodes_run_same_ra_machine_version(
Config3, khepri_machine)),
case SameMacVer of
true ->
_ = rabbit_ct_broker_helpers:rpc_all(
Config3,
rabbit_peer_discovery_backend, api_version, []),
Config3;
false ->
Config5 = rabbit_ct_helpers:run_steps(
Config3,
rabbit_ct_client_helpers:teardown_steps()
++
rabbit_ct_broker_helpers:teardown_steps()),
rabbit_ct_helpers:testcase_finished(Config5, Testcase),
{skip,
"Nodes are using different Khepri Ra machine "
"versions; clustering will likely fail"}
end
catch
error:{exception, undef,
[{rabbit_peer_discovery_backend, api_version, _, _}
Expand Down
28 changes: 24 additions & 4 deletions deps/rabbitmq_peer_discovery_etcd/test/system_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,27 @@ init_per_testcase(Testcase, Config)
case Config3 of
_ when is_list(Config3) ->
try
_ = rabbit_ct_broker_helpers:rpc_all(
Config3, rabbit_peer_discovery_backend, api_version, []),
Config3
SameMacVer = (
rabbit_ct_broker_helpers:
do_nodes_run_same_ra_machine_version(
Config3, khepri_machine)),
case SameMacVer of
true ->
_ = rabbit_ct_broker_helpers:rpc_all(
Config3,
rabbit_peer_discovery_backend, api_version, []),
Config3;
false ->
Config5 = rabbit_ct_helpers:run_steps(
Config3,
rabbit_ct_client_helpers:teardown_steps()
++
rabbit_ct_broker_helpers:teardown_steps()),
rabbit_ct_helpers:testcase_finished(Config5, Testcase),
{skip,
"Nodes are using different Khepri Ra machine "
"versions; clustering will likely fail"}
end
catch
error:{exception, undef,
[{rabbit_peer_discovery_backend, api_version, _, _}
Expand Down Expand Up @@ -239,7 +257,9 @@ wait_for_etcd(EtcdEndpoints) ->
Timeout = 60000,
rabbit_ct_helpers:await_condition(
fun() ->
case eetcd:open(test, EtcdEndpoints) of
Ret = eetcd:open(test, EtcdEndpoints),
ct:pal("Ret = ~p", [Ret]),
case Ret of
{ok, _Pid} -> true;
_ -> false
end
Expand Down