diff options
author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2020-03-20 12:02:19 +0100 |
---|---|---|
committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2020-03-20 12:08:45 +0100 |
commit | 194bc4c8b665c47a152f6b186a0c3579717c5cdc (patch) | |
tree | 698fbe14dc50732037b5e299daf1795b0c5c79a7 | |
parent | 2bef03c67d5645b59a941d36a923b0e83fe4873c (diff) | |
download | rabbitmq-server-git-194bc4c8b665c47a152f6b186a0c3579717c5cdc.tar.gz |
feature_flags_SUITE: Adapt `registry` test
... to explicitely inject its own feature flags, instead of relying on
actual module attributes.
-rw-r--r-- | test/feature_flags_SUITE.erl | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/test/feature_flags_SUITE.erl b/test/feature_flags_SUITE.erl index 24e4c36127..76881b9679 100644 --- a/test/feature_flags_SUITE.erl +++ b/test/feature_flags_SUITE.erl @@ -47,18 +47,6 @@ activating_plugin_with_new_ff_enabled/1 ]). --rabbit_feature_flag( - {ff_a, - #{desc => "Feature flag A", - stability => stable - }}). - --rabbit_feature_flag( - {ff_b, - #{desc => "Feature flag B", - stability => stable - }}). - suite() -> [{timetrap, {minutes, 15}}]. @@ -273,6 +261,14 @@ registry(_Config) -> %% At first, the registry must be uninitialized. ?assertNot(rabbit_ff_registry:is_registry_initialized()), + FeatureFlags = #{ff_a => + #{desc => "Feature flag A", + stability => stable}, + ff_b => + #{desc => "Feature flag B", + stability => stable}}, + rabbit_feature_flags:inject_test_feature_flags(feature_flags_to_app_attrs(FeatureFlags)), + %% After initialization, it must know about the feature flags %% declared in this testsuite. They must be disabled however. rabbit_feature_flags:initialize_registry(), @@ -985,18 +981,20 @@ log_feature_flags_of_all_nodes(Config) -> Config, rabbit_feature_flags, info, [#{color => false, lines => false}]). +feature_flags_to_app_attrs(FeatureFlags) when is_map(FeatureFlags) -> + [{?MODULE, % Application + ?MODULE, % Module + maps:to_list(FeatureFlags)}]. + declare_arbitrary_feature_flag(Config) -> - FeatureFlags = [{ff_from_testsuite, + FeatureFlags = #{ff_from_testsuite => #{desc => "My feature flag", - stability => stable}}], - AppAttrs = [{?MODULE, % Application - ?MODULE, % Module, - FeatureFlags}], + stability => stable}}, rabbit_ct_broker_helpers:rpc_all( Config, rabbit_feature_flags, inject_test_feature_flags, - [AppAttrs]), + [feature_flags_to_app_attrs(FeatureFlags)]), ok. block(Pairs) -> [block(X, Y) || {X, Y} <- Pairs]. |