Skip to content

Commit fde30a0

Browse files
committed
feature_flags_SUITE: Adapt registry test
... to explicitely inject its own feature flags, instead of relying on actual module attributes. (cherry picked from commit 194bc4c)
1 parent fc0c2a1 commit fde30a0

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

test/feature_flags_SUITE.erl

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,6 @@
4747
activating_plugin_with_new_ff_enabled/1
4848
]).
4949

50-
-rabbit_feature_flag(
51-
{ff_a,
52-
#{desc => "Feature flag A",
53-
stability => stable
54-
}}).
55-
56-
-rabbit_feature_flag(
57-
{ff_b,
58-
#{desc => "Feature flag B",
59-
stability => stable
60-
}}).
61-
6250
suite() ->
6351
[{timetrap, {minutes, 15}}].
6452

@@ -269,6 +257,14 @@ registry(_Config) ->
269257
%% At first, the registry must be uninitialized.
270258
?assertNot(rabbit_ff_registry:is_registry_initialized()),
271259

260+
FeatureFlags = #{ff_a =>
261+
#{desc => "Feature flag A",
262+
stability => stable},
263+
ff_b =>
264+
#{desc => "Feature flag B",
265+
stability => stable}},
266+
rabbit_feature_flags:inject_test_feature_flags(feature_flags_to_app_attrs(FeatureFlags)),
267+
272268
%% After initialization, it must know about the feature flags
273269
%% declared in this testsuite. They must be disabled however.
274270
rabbit_feature_flags:initialize_registry(),
@@ -963,18 +959,20 @@ log_feature_flags_of_all_nodes(Config) ->
963959
Config, rabbit_feature_flags, info, [#{color => false,
964960
lines => false}]).
965961

962+
feature_flags_to_app_attrs(FeatureFlags) when is_map(FeatureFlags) ->
963+
[{?MODULE, % Application
964+
?MODULE, % Module
965+
maps:to_list(FeatureFlags)}].
966+
966967
declare_arbitrary_feature_flag(Config) ->
967-
FeatureFlags = [{ff_from_testsuite,
968+
FeatureFlags = #{ff_from_testsuite =>
968969
#{desc => "My feature flag",
969-
stability => stable}}],
970-
AppAttrs = [{?MODULE, % Application
971-
?MODULE, % Module,
972-
FeatureFlags}],
970+
stability => stable}},
973971
rabbit_ct_broker_helpers:rpc_all(
974972
Config,
975973
rabbit_feature_flags,
976974
inject_test_feature_flags,
977-
[AppAttrs]),
975+
[feature_flags_to_app_attrs(FeatureFlags)]),
978976
ok.
979977

980978
block(Pairs) -> [block(X, Y) || {X, Y} <- Pairs].

0 commit comments

Comments
 (0)