From fe3e83ec50313604cf94340943db73c22d553fc1 Mon Sep 17 00:00:00 2001 From: Daniil Fedotov Date: Wed, 7 Sep 2016 12:46:47 +0100 Subject: [PATCH] Fixing some tests --- .../cli/ctl/commands/force_reset_command.ex | 2 +- .../test/list_policies_command_test.exs | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/force_reset_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/force_reset_command.ex index baa39f549a..8ec8449886 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/force_reset_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/force_reset_command.ex @@ -16,7 +16,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ForceResetCommand do @behaviour RabbitMQ.CLI.CommandBehaviour - use RabbitMQ.CLI.DefaultOutput @flags [] def merge_defaults(args, opts), do: {args, opts} @@ -40,4 +39,5 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ForceResetCommand do {:error, RabbitMQ.CLI.ExitCodes.exit_software, RabbitMQ.CLI.DefaultOutput.mnesia_running_error(node_name)} end + use RabbitMQ.CLI.DefaultOutput end diff --git a/deps/rabbitmq_cli/test/list_policies_command_test.exs b/deps/rabbitmq_cli/test/list_policies_command_test.exs index 5520962fed..59d4cff3ac 100644 --- a/deps/rabbitmq_cli/test/list_policies_command_test.exs +++ b/deps/rabbitmq_cli/test/list_policies_command_test.exs @@ -35,6 +35,8 @@ defmodule ListPoliciesCommandTest do add_vhost @vhost + enable_federation_plugin() + on_exit(fn -> delete_vhost @vhost :erlang.disconnect_node(get_rabbit_hostname) @@ -44,6 +46,32 @@ defmodule ListPoliciesCommandTest do :ok end + def enable_federation_plugin() do + node = get_rabbit_hostname + + {:ok, plugins_file} = :rabbit_misc.rpc_call(node, + :application, :get_env, + [:rabbit, :enabled_plugins_file]) + {:ok, plugins_dir} = :rabbit_misc.rpc_call(node, + :application, :get_env, + [:rabbit, :plugins_dir]) + {:ok, rabbitmq_home} = :rabbit_misc.rpc_call(node, :file, :get_cwd, []) + + {:ok, [enabled_plugins]} = :file.consult(plugins_file) + + opts = %{enabled_plugins_file: plugins_file, + plugins_dir: plugins_dir, + rabbitmq_home: rabbitmq_home, + online: true, offline: false} + + plugins = currently_active_plugins(%{opts: %{node: node}}) + case Enum.member?(plugins, :rabbitmq_federation) do + true -> :ok + false -> + set_enabled_plugins(get_rabbit_hostname, plugins ++ [:rabbitmq_federation], opts) + end + end + setup context do on_exit(fn ->