Skip to content

Commit dffcf0c

Browse files
committed
rabbitmq_ct_helpers: Change how Mnesia/Khepri is selected
[Why] With `khepr_db` enabled by default, we need another way to disable it to select Mnesia instead. [How] For Khepri, we force the `khepri_db` feature flag. For Mnesia, we force an empty list, meaning all stable feature flags are disabled by default. Testsuites will have to enable whatever feature flags they need, though they should already do that. While here, change `rjms_topic_selector_SUITE` to only choose Khepri without specifying any feature flags.
1 parent 166f698 commit dffcf0c

File tree

6 files changed

+45
-41
lines changed

6 files changed

+45
-41
lines changed

deps/rabbit/test/bindings_SUITE.erl

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ end_per_suite(Config) ->
7272
% init_per_group_common(Group, Config, 1);
7373
init_per_group(khepri_migration = Group, Config) ->
7474
case rabbit_ct_broker_helpers:configured_metadata_store(Config) of
75-
{khepri, _} ->
75+
khepri ->
7676
{skip, "skip khepri migration test when khepri already configured"};
7777
mnesia ->
7878
init_per_group_common(Group, Config, 1)

deps/rabbit/test/clustering_management_SUITE.erl

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ init_per_group(khepri_store, Config) ->
138138
end;
139139
init_per_group(mnesia_store, Config) ->
140140
case rabbit_ct_broker_helpers:configured_metadata_store(Config) of
141-
{khepri, _} ->
141+
khepri ->
142142
{skip, "These tests target mnesia"};
143143
_ ->
144144
Config

deps/rabbit/test/clustering_recovery_SUITE.erl

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ init_per_group(khepri_store, Config) ->
8080
end;
8181
init_per_group(mnesia_store, Config) ->
8282
case rabbit_ct_broker_helpers:configured_metadata_store(Config) of
83-
{khepri, _} ->
83+
khepri ->
8484
{skip, "These tests target mnesia"};
8585
_ ->
8686
Config

deps/rabbitmq_ct_helpers/src/rabbit_ct_broker_helpers.erl

+39-35
Original file line numberDiff line numberDiff line change
@@ -215,19 +215,19 @@ setup_steps() ->
215215
fun rabbit_ct_helpers:ensure_rabbitmqctl_app/1,
216216
fun rabbit_ct_helpers:ensure_rabbitmq_plugins_cmd/1,
217217
fun set_lager_flood_limit/1,
218+
fun configure_metadata_store/1,
218219
fun start_rabbitmq_nodes/1,
219-
fun share_dist_and_proxy_ports_map/1,
220-
fun configure_metadata_store/1
220+
fun share_dist_and_proxy_ports_map/1
221221
];
222222
_ ->
223223
[
224224
fun rabbit_ct_helpers:ensure_rabbitmqctl_cmd/1,
225225
fun rabbit_ct_helpers:load_rabbitmqctl_app/1,
226226
fun rabbit_ct_helpers:ensure_rabbitmq_plugins_cmd/1,
227227
fun set_lager_flood_limit/1,
228+
fun configure_metadata_store/1,
228229
fun start_rabbitmq_nodes/1,
229-
fun share_dist_and_proxy_ports_map/1,
230-
fun configure_metadata_store/1
230+
fun share_dist_and_proxy_ports_map/1
231231
]
232232
end.
233233

@@ -999,57 +999,61 @@ share_dist_and_proxy_ports_map(Config) ->
999999
configured_metadata_store(Config) ->
10001000
case rabbit_ct_helpers:get_config(Config, metadata_store) of
10011001
khepri ->
1002-
{khepri, []};
1003-
{khepri, _FFs0} = Khepri ->
1004-
Khepri;
1002+
khepri;
10051003
mnesia ->
10061004
mnesia;
10071005
_ ->
10081006
case os:getenv("RABBITMQ_METADATA_STORE") of
1009-
"khepri" ->
1010-
{khepri, []};
1011-
_ ->
1012-
mnesia
1007+
"khepri" -> khepri;
1008+
_ -> mnesia
10131009
end
10141010
end.
10151011

10161012
configure_metadata_store(Config) ->
10171013
ct:log("Configuring metadata store..."),
1014+
Value = rabbit_ct_helpers:get_app_env(
1015+
Config, rabbit, forced_feature_flags_on_init, undefined),
10181016
case configured_metadata_store(Config) of
1019-
{khepri, FFs0} ->
1020-
case enable_khepri_metadata_store(Config, FFs0) of
1021-
{skip, _} = Skip ->
1022-
_ = stop_rabbitmq_nodes(Config),
1023-
Skip;
1024-
Config1 ->
1025-
Config1
1017+
khepri ->
1018+
ct:log("Enabling Khepri metadata store"),
1019+
case Value of
1020+
undefined ->
1021+
rabbit_ct_helpers:merge_app_env(
1022+
Config,
1023+
{rabbit,
1024+
[{forced_feature_flags_on_init,
1025+
{rel, [khepri_db], []}}]});
1026+
_ ->
1027+
rabbit_ct_helpers:merge_app_env(
1028+
Config,
1029+
{rabbit,
1030+
[{forced_feature_flags_on_init,
1031+
[khepri_db | Value]}]})
10261032
end;
10271033
mnesia ->
10281034
ct:log("Enabling Mnesia metadata store"),
1029-
Config
1035+
case Value of
1036+
undefined ->
1037+
rabbit_ct_helpers:merge_app_env(
1038+
Config,
1039+
{rabbit,
1040+
[{forced_feature_flags_on_init,
1041+
{rel, [], [khepri_db]}}]});
1042+
_ ->
1043+
rabbit_ct_helpers:merge_app_env(
1044+
Config,
1045+
{rabbit,
1046+
[{forced_feature_flags_on_init,
1047+
Value -- [khepri_db]}]})
1048+
end
10301049
end.
10311050

1032-
enable_khepri_metadata_store(Config, FFs0) ->
1033-
ct:log("Enabling Khepri metadata store"),
1034-
FFs = [khepri_db | FFs0],
1035-
lists:foldl(fun(_FF, {skip, _Reason} = Skip) ->
1036-
Skip;
1037-
(FF, C) ->
1038-
case enable_feature_flag(C, FF) of
1039-
ok ->
1040-
C;
1041-
{skip, _} = Skip ->
1042-
ct:pal("Enabling metadata store failed: ~p", [Skip]),
1043-
Skip
1044-
end
1045-
end, Config, FFs).
1046-
10471051
%% Waits until the metadata store replica on Node is up to date with the leader.
10481052
await_metadata_store_consistent(Config, Node) ->
10491053
case configured_metadata_store(Config) of
10501054
mnesia ->
10511055
ok;
1052-
{khepri, _} ->
1056+
khepri ->
10531057
RaClusterName = rabbit_khepri:get_ra_cluster_name(),
10541058
Leader = rpc(Config, Node, ra_leaderboard, lookup_leader, [RaClusterName]),
10551059
LastAppliedLeader = ra_last_applied(Leader),

deps/rabbitmq_jms_topic_exchange/test/rjms_topic_selector_SUITE.erl

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ init_per_group(mnesia_store = Group, Config0) ->
5656
init_per_group(khepri_store = Group, Config0) ->
5757
Config = rabbit_ct_helpers:set_config(
5858
Config0,
59-
[{metadata_store, {khepri, [khepri_db]}}]),
59+
[{metadata_store, khepri}]),
6060
init_per_group_common(Group, Config);
6161
init_per_group(khepri_migration = Group, Config0) ->
6262
Config = rabbit_ct_helpers:set_config(Config0, [{metadata_store, mnesia}]),

deps/rabbitmq_recent_history_exchange/test/system_SUITE.erl

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ end_per_suite(Config) ->
5959

6060
init_per_group(mnesia_store, Config) ->
6161
case rabbit_ct_broker_helpers:configured_metadata_store(Config) of
62-
{khepri, _} -> {skip, "These tests target Mnesia"};
63-
_ -> Config
62+
khepri -> {skip, "These tests target Mnesia"};
63+
_ -> Config
6464
end;
6565
init_per_group(khepri_store, Config) ->
6666
case rabbit_ct_broker_helpers:configured_metadata_store(Config) of

0 commit comments

Comments
 (0)