diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2020-04-06 14:09:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-06 14:09:31 +0200 |
| commit | 7f614f13adad5cf278d56083cd6ba8f72d33a9e3 (patch) | |
| tree | 348b427c57852abf8349e1d84bd7ac1494464e19 /test | |
| parent | bfc5959444f7e650dced2fe7ebabb5cfc2bf3821 (diff) | |
| parent | be9a642f928816f9d02856012ff6d7a421004c1e (diff) | |
| download | rabbitmq-server-git-7f614f13adad5cf278d56083cd6ba8f72d33a9e3.tar.gz | |
Merge pull request #2302 from rabbitmq/work-around-cli-circular-dep-in-feature_flags_SUITE
feature_flags_SUITE: Work around CLI/rabbitmq-server circular dependency
Diffstat (limited to 'test')
| -rw-r--r-- | test/feature_flags_SUITE.erl | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/test/feature_flags_SUITE.erl b/test/feature_flags_SUITE.erl index e3dd3a64db..443be46d3d 100644 --- a/test/feature_flags_SUITE.erl +++ b/test/feature_flags_SUITE.erl @@ -125,7 +125,8 @@ init_per_group(clustering, Config) -> {rmq_nodes_clustered, false}, {start_rmq_with_plugins_disabled, true}]), rabbit_ct_helpers:run_setup_steps(Config1, [ - fun build_my_plugin/1 + fun build_my_plugin/1, + fun work_around_cli_and_rabbit_circular_dep/1 ]); init_per_group(activating_plugin, Config) -> Config1 = rabbit_ct_helpers:set_config( @@ -134,7 +135,8 @@ init_per_group(activating_plugin, Config) -> {rmq_nodes_clustered, true}, {start_rmq_with_plugins_disabled, true}]), rabbit_ct_helpers:run_setup_steps(Config1, [ - fun build_my_plugin/1 + fun build_my_plugin/1, + fun work_around_cli_and_rabbit_circular_dep/1 ]); init_per_group(_, Config) -> Config. @@ -958,10 +960,43 @@ list_my_plugin_plugins(PluginSrcDir) -> end, Files). remove_other_plugins(PluginSrcDir, OtherPlugins) -> - [ok = file:delete( - filename:join(PluginSrcDir, Filename)) + [ok = file:delete(filename:join(PluginSrcDir, Filename)) || Filename <- OtherPlugins]. +work_around_cli_and_rabbit_circular_dep(Config) -> + %% FIXME: We also need to copy `rabbit` in `my_plugins` plugins + %% directory, not because `my_plugin` depends on it, but because the + %% CLI erroneously depends on the broker. + %% + %% This can't be fixed easily because this is a circular dependency + %% (i.e. the broker depends on the CLI). So until a proper solution + %% is implemented, keep this second copy of the broker for the CLI + %% to find it. + InitialPluginsDir = filename:join( + ?config(current_srcdir, Config), + "plugins"), + PluginsDir = ?config(rmq_plugins_dir, Config), + lists:foreach( + fun(Path) -> + Filename = filename:basename(Path), + IsRabbit = re:run( + Filename, + "^rabbit-", [{capture, none}]) =:= match, + case IsRabbit of + true -> + Dest = filename:join(PluginsDir, Filename), + ct:pal( + ?LOW_IMPORTANCE, + "Copy `~s` to `~s` to fix CLI erroneous " + "dependency on `rabbit`", [Path, Dest]), + {ok, _} = file:copy(Path, Dest); + false -> + ok + end + end, + filelib:wildcard(filename:join(InitialPluginsDir, "*"))), + Config. + enable_feature_flag_on(Config, Node, FeatureName) -> rabbit_ct_broker_helpers:rpc( Config, Node, rabbit_feature_flags, enable, [FeatureName]). |
