Skip to content
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: 7 additions & 2 deletions deps/rabbit/src/rabbit_ff_controller.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1840,8 +1840,13 @@ enable_dependencies1(
rabbit_deprecated_features:is_feature_used_callback_ret() |
run_callback_error()}.

run_callback(Nodes, FeatureName, Command, Extra, Timeout) ->
FeatureProps = rabbit_ff_registry_wrapper:get(FeatureName),
run_callback([FirstNode | _] = Nodes, FeatureName, Command, Extra, Timeout) ->
%% We need to take the callback definition from a node in the `Nodes' list
%% because the local node may not know this feature flag and thus does not
%% have the callback definition.
FeatureProps = erpc:call(
FirstNode,
rabbit_ff_registry_wrapper, get, [FeatureName]),
Callbacks = maps:get(callbacks, FeatureProps, #{}),
case Callbacks of
#{Command := {CallbackMod, CallbackFun}}
Expand Down
36 changes: 34 additions & 2 deletions deps/rabbit/test/feature_flags_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
clustering_ok_with_new_ff_enabled_from_plugin_on_some_nodes/1,
clustering_ok_with_supported_required_ff/1,
activating_plugin_with_new_ff_disabled/1,
activating_plugin_with_new_ff_enabled/1
activating_plugin_with_new_ff_enabled/1,
enable_plugin_feature_flag_after_deactivating_plugin/1
]).

suite() ->
Expand Down Expand Up @@ -95,7 +96,8 @@ groups() ->
{activating_plugin, [],
[
activating_plugin_with_new_ff_disabled,
activating_plugin_with_new_ff_enabled
activating_plugin_with_new_ff_enabled,
enable_plugin_feature_flag_after_deactivating_plugin
]}
],

Expand Down Expand Up @@ -1260,6 +1262,36 @@ activating_plugin_with_new_ff_enabled(Config) ->
end,
ok.

enable_plugin_feature_flag_after_deactivating_plugin(Config) ->
FFSubsysOk = is_feature_flag_subsystem_available(Config),

log_feature_flags_of_all_nodes(Config),
case FFSubsysOk of
true ->
?assertEqual([false, false],
is_feature_flag_supported(Config, plugin_ff)),
?assertEqual([false, false],
is_feature_flag_enabled(Config, plugin_ff));
false ->
ok
end,

rabbit_ct_broker_helpers:enable_plugin(Config, 1, "my_plugin"),
rabbit_ct_broker_helpers:disable_plugin(Config, 1, "my_plugin"),

log_feature_flags_of_all_nodes(Config),
case FFSubsysOk of
true ->
enable_feature_flag_on(Config, 0, plugin_ff),
?assertEqual([true, true],
is_feature_flag_supported(Config, plugin_ff)),
?assertEqual([false, true],
is_feature_flag_enabled(Config, plugin_ff));
false ->
ok
end,
ok.

%% -------------------------------------------------------------------
%% Internal helpers.
%% -------------------------------------------------------------------
Expand Down
Loading