Fixing some tests

This commit is contained in:
Daniil Fedotov 2016-09-07 12:46:47 +01:00
parent e1e79f6e46
commit fe3e83ec50
2 changed files with 29 additions and 1 deletions

View File

@ -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

View File

@ -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 ->