Fix some compiler warnings in tests

This commit is contained in:
Daniil Fedotov 2017-01-24 12:33:48 +00:00
parent 3871c4ccde
commit 1a7bdc871b
78 changed files with 335 additions and 335 deletions

View File

@ -22,10 +22,10 @@ defmodule AddUserCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -34,7 +34,7 @@ defmodule AddUserCommandTest do
setup context do
on_exit(context, fn -> delete_user(context[:user]) end)
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate: on an inappropriate number of arguments, validate should return an arg count error" do

View File

@ -23,14 +23,14 @@ defmodule AddVhostCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
setup context do

View File

@ -24,10 +24,10 @@ defmodule AuthenticateUserCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -37,7 +37,7 @@ defmodule AuthenticateUserCommandTest do
setup context do
add_user(@user, @password)
on_exit(context, fn -> delete_user(@user) end)
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate: invalid number of arguments returns a validation failure" do

View File

@ -23,13 +23,13 @@ defmodule CancelSyncQueueCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
start_rabbitmq_app
on_exit([], fn ->
start_rabbitmq_app
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -38,7 +38,7 @@ defmodule CancelSyncQueueCommandTest do
setup do
{:ok, opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
vhost: @vhost
}}
end

View File

@ -22,13 +22,13 @@ defmodule ChangeClusterNodeTypeCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
start_rabbitmq_app
on_exit([], fn ->
start_rabbitmq_app
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -37,7 +37,7 @@ defmodule ChangeClusterNodeTypeCommandTest do
setup do
{:ok, opts: %{
node: get_rabbit_hostname
node: get_rabbit_hostname()
}}
end
@ -88,7 +88,7 @@ defmodule ChangeClusterNodeTypeCommandTest do
test "banner", context do
assert @command.banner(["ram"], context[:opts]) =~
~r/Turning #{get_rabbit_hostname} into a ram node/
~r/Turning #{get_rabbit_hostname()} into a ram node/
end
test "output mnesia is running error", context do

View File

@ -21,10 +21,10 @@ defmodule ChangePasswordCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
:ok
@ -33,7 +33,7 @@ defmodule ChangePasswordCommandTest do
setup context do
add_user(@user, @password)
on_exit(context, fn -> delete_user(@user) end)
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate: argument count validation" do

View File

@ -24,10 +24,10 @@ defmodule ClearGlobalParameterCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
:ok
@ -41,7 +41,7 @@ defmodule ClearGlobalParameterCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname
node: get_rabbit_hostname()
}
}
end

View File

@ -30,13 +30,13 @@ defmodule ClearOperatorPolicyCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_vhost @vhost
on_exit([], fn ->
delete_vhost @vhost
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -51,7 +51,7 @@ defmodule ClearOperatorPolicyCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname
node: get_rabbit_hostname()
}
}
end

View File

@ -28,7 +28,7 @@ defmodule ClearParameterCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_vhost @vhost
@ -36,7 +36,7 @@ defmodule ClearParameterCommandTest do
on_exit([], fn ->
delete_vhost @vhost
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -51,7 +51,7 @@ defmodule ClearParameterCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname
node: get_rabbit_hostname()
}
}
end

View File

@ -21,10 +21,10 @@ defmodule ClearPasswordCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -34,7 +34,7 @@ defmodule ClearPasswordCommandTest do
setup context do
add_user(@user, @password)
on_exit(context, fn -> delete_user(@user) end)
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate: argument count is correct" do

View File

@ -23,14 +23,14 @@ defmodule ClearPermissionsTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_user(@user, @password)
add_vhost(@specific_vhost)
on_exit([], fn ->
delete_user(@user)
delete_vhost(@specific_vhost)
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -43,7 +43,7 @@ defmodule ClearPermissionsTest do
{
:ok,
opts: %{node: get_rabbit_hostname, vhost: context[:vhost]}
opts: %{node: get_rabbit_hostname(), vhost: context[:vhost]}
}
end

View File

@ -30,7 +30,7 @@ defmodule ClearPolicyCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_vhost @vhost
@ -38,7 +38,7 @@ defmodule ClearPolicyCommandTest do
on_exit([], fn ->
delete_vhost @vhost
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -53,7 +53,7 @@ defmodule ClearPolicyCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname
node: get_rabbit_hostname()
}
}
end

View File

@ -23,7 +23,7 @@ defmodule ClearTopicPermissionsTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_user(@user, @password)
add_vhost(@specific_vhost)
@ -31,7 +31,7 @@ defmodule ClearTopicPermissionsTest do
clear_topic_permissions(@user, @specific_vhost)
delete_user(@user)
delete_vhost(@specific_vhost)
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -43,7 +43,7 @@ defmodule ClearTopicPermissionsTest do
set_topic_permissions(@user, @specific_vhost, "topic1", "^a")
{
:ok,
opts: %{node: get_rabbit_hostname, vhost: context[:vhost]}
opts: %{node: get_rabbit_hostname(), vhost: context[:vhost]}
}
end

View File

@ -26,13 +26,13 @@ defmodule ClearVhostLimitsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_vhost @vhost
on_exit([], fn ->
delete_vhost @vhost
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
:ok
@ -46,7 +46,7 @@ defmodule ClearVhostLimitsCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname
node: get_rabbit_hostname()
}
}
end

View File

@ -28,12 +28,12 @@ defmodule CloseAllConnectionsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
close_all_connections(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
close_all_connections(get_rabbit_hostname())
on_exit([], fn ->
close_all_connections(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname)
close_all_connections(get_rabbit_hostname())
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -41,7 +41,7 @@ defmodule CloseAllConnectionsCommandTest do
end
setup context do
close_all_connections(get_rabbit_hostname)
close_all_connections(get_rabbit_hostname())
{:ok, context}
end
@ -77,7 +77,7 @@ defmodule CloseAllConnectionsCommandTest do
end
test "run: a close connections request for a non-existing vhost does nothing", context do
close_all_connections(get_rabbit_hostname)
close_all_connections(get_rabbit_hostname())
with_connection(@vhost, fn(_) ->
node = @helpers.parse_node(context[:node])
nodes = @helpers.nodes_in_cluster(node)

View File

@ -26,12 +26,12 @@ defmodule CloseConnectionCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
close_all_connections(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
close_all_connections(get_rabbit_hostname())
on_exit([], fn ->
close_all_connections(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname)
close_all_connections(get_rabbit_hostname())
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -39,7 +39,7 @@ defmodule CloseConnectionCommandTest do
end
setup do
{:ok, opts: %{node: get_rabbit_hostname, timeout: :infinity}}
{:ok, opts: %{node: get_rabbit_hostname(), timeout: :infinity}}
end
test "validate: with an invalid number of arguments returns an arg count error", context do

View File

@ -22,10 +22,10 @@ defmodule ClusterStatusCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -33,7 +33,7 @@ defmodule ClusterStatusCommandTest do
end
setup do
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate: argument count validates", context do
@ -58,6 +58,6 @@ defmodule ClusterStatusCommandTest do
s = @command.banner([], context[:opts])
assert s =~ ~r/Cluster status of node/
assert s =~ ~r/#{get_rabbit_hostname}/
assert s =~ ~r/#{get_rabbit_hostname()}/
end
end

View File

@ -34,7 +34,7 @@ defmodule HelpersTest do
:ok
end
## --------------------- get_rabbit_hostname/0 tests -------------------------
## --------------------- get_rabbit_hostname()/0 tests -------------------------
test "RabbitMQ hostname is properly formed" do
assert @subject.get_rabbit_hostname() |> Atom.to_string =~ ~r/rabbit@\w+/

View File

@ -24,10 +24,10 @@ defmodule DeleteUserCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -38,7 +38,7 @@ defmodule DeleteUserCommandTest do
add_user(context[:user], @password)
on_exit(context, fn -> delete_user(context[:user]) end)
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
@tag user: @user

View File

@ -23,10 +23,10 @@ defmodule DeleteVhostCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -37,7 +37,7 @@ defmodule DeleteVhostCommandTest do
add_vhost(context[:vhost])
on_exit(context, fn -> delete_vhost(context[:vhost]) end)
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate: argument count validates" do

View File

@ -22,10 +22,10 @@ defmodule CipherSuitesCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -34,7 +34,7 @@ defmodule CipherSuitesCommandTest do
setup context do
{:ok, opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
timeout: context[:test_timeout] || 30000,
openssl_format: context[:openssl_format] || false
}}

View File

@ -22,10 +22,10 @@ defmodule ErlangCookieHashCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -34,7 +34,7 @@ defmodule ErlangCookieHashCommandTest do
setup context do
{:ok, opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
timeout: context[:test_timeout] || 30000
}}
end

View File

@ -22,10 +22,10 @@ defmodule MaybeStuckCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -34,7 +34,7 @@ defmodule MaybeStuckCommandTest do
setup context do
{:ok, opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
timeout: context[:test_timeout] || 15000
}}
end

View File

@ -22,10 +22,10 @@ defmodule EnvironmentCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -33,7 +33,7 @@ defmodule EnvironmentCommandTest do
end
setup do
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate: argument count validates" do
@ -41,7 +41,7 @@ defmodule EnvironmentCommandTest do
assert @command.validate(["extra"], %{}) == {:validation_failure, :too_many_args}
end
@tag target: get_rabbit_hostname
@tag target: get_rabbit_hostname()
test "run: environment request on a named, active RMQ node is successful", context do
assert @command.run([], context[:opts])[:kernel] != nil
assert @command.run([], context[:opts])[:rabbit] != nil
@ -57,6 +57,6 @@ defmodule EnvironmentCommandTest do
test "banner", context do
assert @command.banner([], context[:opts])
=~ ~r/Application environment of node #{get_rabbit_hostname}/
=~ ~r/Application environment of node #{get_rabbit_hostname()}/
end
end

View File

@ -23,10 +23,10 @@ defmodule EvalCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -34,7 +34,7 @@ defmodule EvalCommandTest do
end
setup _ do
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate: providing too few arguments fails validation" do

View File

@ -22,10 +22,10 @@ defmodule ForceBootCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -33,7 +33,7 @@ defmodule ForceBootCommandTest do
end
setup _ do
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate: providing too many arguments fails validation" do
@ -49,7 +49,7 @@ defmodule ForceBootCommandTest do
stop_rabbitmq_app()
on_exit(fn -> start_rabbitmq_app() end)
assert @command.run([], context[:opts]) == :ok
mnesia_dir = :rpc.call(get_rabbit_hostname, :rabbit_mnesia, :dir, [])
mnesia_dir = :rpc.call(get_rabbit_hostname(), :rabbit_mnesia, :dir, [])
path = Path.join(mnesia_dir, "force_load")
assert File.exists?(path)

View File

@ -22,13 +22,13 @@ defmodule ForceResetCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
start_rabbitmq_app
on_exit([], fn ->
start_rabbitmq_app
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -36,7 +36,7 @@ defmodule ForceResetCommandTest do
end
setup do
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate: with extra arguments returns an arg count error", context do
@ -69,7 +69,7 @@ defmodule ForceResetCommandTest do
end
test "banner", context do
assert @command.banner([], context[:opts]) =~ ~r/Forcefully resetting node #{get_rabbit_hostname}/
assert @command.banner([], context[:opts]) =~ ~r/Forcefully resetting node #{get_rabbit_hostname()}/
end
test "output mnesia is running error", context do

View File

@ -22,7 +22,7 @@ defmodule ForgetClusterNodeCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
node = get_rabbit_hostname
node = get_rabbit_hostname()
:net_kernel.connect_node(node)
start_rabbitmq_app
@ -45,7 +45,7 @@ defmodule ForgetClusterNodeCommandTest do
end
setup context do
{:ok, opts: Map.merge(context[:opts], %{node: get_rabbit_hostname})
{:ok, opts: Map.merge(context[:opts], %{node: get_rabbit_hostname()})
}
end

View File

@ -22,13 +22,13 @@ defmodule JoinClusterCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
start_rabbitmq_app
on_exit([], fn ->
start_rabbitmq_app
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -37,7 +37,7 @@ defmodule JoinClusterCommandTest do
setup do
{:ok, opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
disc: true,
ram: false,
}}
@ -107,7 +107,7 @@ defmodule JoinClusterCommandTest do
test "banner", context do
assert @command.banner(["a"], context[:opts]) =~
~r/Clustering node #{get_rabbit_hostname} with a/
~r/Clustering node #{get_rabbit_hostname()} with a/
end
test "output mnesia is running error", context do

View File

@ -10,10 +10,10 @@ defmodule ListBindingsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -29,7 +29,7 @@ defmodule ListBindingsCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
timeout: context[:test_timeout] || @default_timeout,
vhost: @vhost
}

View File

@ -23,13 +23,13 @@ defmodule ListChannelsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
close_all_connections(get_rabbit_hostname)
close_all_connections(get_rabbit_hostname())
on_exit([], fn ->
close_all_connections(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname)
close_all_connections(get_rabbit_hostname())
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -40,7 +40,7 @@ defmodule ListChannelsCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
timeout: context[:test_timeout] || @default_timeout
}
}
@ -76,7 +76,7 @@ defmodule ListChannelsCommandTest do
end
test "run: multiple channels on multiple connections", context do
node_name = get_rabbit_hostname
node_name = get_rabbit_hostname()
close_all_connections(node_name)
existent_channels = :rabbit_misc.rpc_call(node_name,:rabbit_channel, :list, [])
with_channel("/", fn(_channel1) ->
@ -98,8 +98,8 @@ defmodule ListChannelsCommandTest do
end
test "run: multiple channels on single connection", context do
node_name = get_rabbit_hostname
close_all_connections(get_rabbit_hostname)
node_name = get_rabbit_hostname()
close_all_connections(get_rabbit_hostname())
with_connection("/", fn(conn) ->
existent_channels = :rabbit_misc.rpc_call(node_name,:rabbit_channel, :list, [])
{:ok, _} = AMQP.Channel.open(conn)
@ -121,7 +121,7 @@ defmodule ListChannelsCommandTest do
end
test "run: info keys order is preserved", context do
close_all_connections(get_rabbit_hostname)
close_all_connections(get_rabbit_hostname())
with_channel("/", fn(_channel) ->
channels = run_command_to_list(@command, [~w(connection vhost name pid number user), context[:opts]])
chan = Enum.at(channels, 0)

View File

@ -8,13 +8,13 @@ defmodule ListConnectionsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
close_all_connections(get_rabbit_hostname)
close_all_connections(get_rabbit_hostname())
on_exit([], fn ->
close_all_connections(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname)
close_all_connections(get_rabbit_hostname())
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -25,7 +25,7 @@ defmodule ListConnectionsCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
timeout: context[:test_timeout] || @default_timeout
}
}

View File

@ -11,10 +11,10 @@ defmodule ListConsumersCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -30,7 +30,7 @@ defmodule ListConsumersCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
timeout: context[:test_timeout] || @default_timeout,
vhost: @vhost
}
@ -68,7 +68,7 @@ defmodule ListConsumersCommandTest do
end
test "run: no consumers for no open connections", context do
close_all_connections(get_rabbit_hostname)
close_all_connections(get_rabbit_hostname())
[] = run_command_to_list(@command, [["queue_name"], context[:opts]])
end

View File

@ -23,10 +23,10 @@ defmodule ListExchangesCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -43,7 +43,7 @@ defmodule ListExchangesCommandTest do
:ok,
opts: %{
quiet: true,
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
timeout: context[:test_timeout] || @default_timeout,
vhost: @vhost
}

View File

@ -25,11 +25,11 @@ defmodule ListGlobalParametersCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
node = get_rabbit_hostname
node = get_rabbit_hostname()
:net_kernel.connect_node(node)
on_exit(fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
:ok
@ -43,7 +43,7 @@ defmodule ListGlobalParametersCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
timeout: (context[:timeout] || :infinity),
}
}

View File

@ -31,13 +31,13 @@ defmodule ListOperatorPoliciesCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_vhost @vhost
on_exit(fn ->
delete_vhost @vhost
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -53,7 +53,7 @@ defmodule ListOperatorPoliciesCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
timeout: (context[:timeout] || :infinity),
vhost: context[:vhost],
apply_to: @apply_to,

View File

@ -29,7 +29,7 @@ defmodule ListParametersCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
node = get_rabbit_hostname
node = get_rabbit_hostname()
:net_kernel.connect_node(node)
{:ok, plugins_file} = :rabbit_misc.rpc_call(node,
@ -53,9 +53,9 @@ defmodule ListParametersCommandTest do
enable_federation_plugin()
on_exit(fn ->
set_enabled_plugins(enabled_plugins, :online, get_rabbit_hostname, opts)
set_enabled_plugins(enabled_plugins, :online, get_rabbit_hostname(), opts)
delete_vhost @vhost
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -71,7 +71,7 @@ defmodule ListParametersCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
timeout: (context[:timeout] || :infinity),
vhost: context[:vhost]
}

View File

@ -27,14 +27,14 @@ defmodule ListPermissionsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_vhost @vhost
set_permissions @user, @vhost, ["^guest-.*", ".*", ".*"]
on_exit([], fn ->
delete_vhost @vhost
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -45,7 +45,7 @@ defmodule ListPermissionsCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
timeout: context[:test_timeout],
vhost: "/"
}

View File

@ -31,7 +31,7 @@ defmodule ListPoliciesCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_vhost @vhost
@ -39,7 +39,7 @@ defmodule ListPoliciesCommandTest do
on_exit(fn ->
delete_vhost @vhost
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -55,7 +55,7 @@ defmodule ListPoliciesCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
timeout: (context[:timeout] || :infinity),
vhost: context[:vhost],
apply_to: @apply_to,

View File

@ -11,16 +11,16 @@ defmodule ListQueuesCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
reset_vm_memory_high_watermark()
delete_all_queues()
close_all_connections(get_rabbit_hostname)
close_all_connections(get_rabbit_hostname())
on_exit([], fn ->
delete_all_queues()
close_all_connections(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname)
close_all_connections(get_rabbit_hostname())
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -37,7 +37,7 @@ defmodule ListQueuesCommandTest do
:ok,
opts: %{
quiet: true,
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
timeout: context[:test_timeout] || @default_timeout,
vhost: @vhost,
offline: false,

View File

@ -28,7 +28,7 @@ defmodule ListTopicPermissionsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_vhost(@vhost)
add_user(@user, @password)
@ -39,7 +39,7 @@ defmodule ListTopicPermissionsCommandTest do
clear_topic_permissions(@user, @vhost)
delete_user(@user)
delete_vhost @vhost
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -50,7 +50,7 @@ defmodule ListTopicPermissionsCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
timeout: context[:test_timeout],
vhost: "/"
}

View File

@ -22,10 +22,10 @@ defmodule ListUserPermissionsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -46,7 +46,7 @@ defmodule ListUserPermissionsCommandTest do
{
:ok,
opts: %{node: get_rabbit_hostname, timeout: context[:test_timeout]},
opts: %{node: get_rabbit_hostname(), timeout: context[:test_timeout]},
result: default_result,
no_such_user: no_such_user_result,
timeout: {:badrpc, :timeout}

View File

@ -22,14 +22,14 @@ defmodule ListUserTopicPermissionsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
set_topic_permissions("guest", "/", "amq.topic", "^a")
set_topic_permissions("guest", "/", "topic1", "^a")
on_exit([], fn ->
clear_topic_permissions("guest", "/")
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -41,7 +41,7 @@ defmodule ListUserTopicPermissionsCommandTest do
{
:ok,
opts: %{node: get_rabbit_hostname, timeout: context[:test_timeout]},
opts: %{node: get_rabbit_hostname(), timeout: context[:test_timeout]},
no_such_user: no_such_user_result,
timeout: {:badrpc, :timeout}
}

View File

@ -26,10 +26,10 @@ defmodule ListUsersCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -45,7 +45,7 @@ defmodule ListUsersCommandTest do
add_user @user, @password
on_exit([], fn -> delete_user @user end)
{:ok, opts: %{node: get_rabbit_hostname, timeout: context[:test_timeout]}}
{:ok, opts: %{node: get_rabbit_hostname(), timeout: context[:test_timeout]}}
end
test "validate: On incorrect number of commands, return an arg count error" do

View File

@ -29,13 +29,13 @@ defmodule ListVhostLimitsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_vhost @vhost
on_exit([], fn ->
delete_vhost @vhost
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
:ok
@ -54,7 +54,7 @@ defmodule ListVhostLimitsCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname
node: get_rabbit_hostname()
},
vhost: vhost
}

View File

@ -26,7 +26,7 @@ defmodule ListVhostsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_vhost @vhost1
add_vhost @vhost2
@ -35,7 +35,7 @@ defmodule ListVhostsCommandTest do
on_exit([], fn ->
delete_vhost @vhost1
delete_vhost @vhost2
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -75,7 +75,7 @@ defmodule ListVhostsCommandTest do
setup context do
{
:ok,
opts: %{node: get_rabbit_hostname, timeout: context[:test_timeout]}
opts: %{node: get_rabbit_hostname(), timeout: context[:test_timeout]}
}
end

View File

@ -22,13 +22,13 @@ defmodule NodeHealthCheckCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
reset_vm_memory_high_watermark()
on_exit([], fn ->
reset_vm_memory_high_watermark()
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -36,7 +36,7 @@ defmodule NodeHealthCheckCommandTest do
end
setup do
{:ok, opts: %{node: get_rabbit_hostname, timeout: 70000}}
{:ok, opts: %{node: get_rabbit_hostname(), timeout: 70000}}
end
test "validate: with extra arguments returns an arg count error", context do
@ -75,6 +75,6 @@ defmodule NodeHealthCheckCommandTest do
test "banner", context do
assert @command.banner([], context[:opts]) |> Enum.join("\n") =~ ~r/Checking health/
assert @command.banner([], context[:opts]) |> Enum.join("\n") =~ ~r/#{get_rabbit_hostname}/
assert @command.banner([], context[:opts]) |> Enum.join("\n") =~ ~r/#{get_rabbit_hostname()}/
end
end

View File

@ -25,7 +25,7 @@ defmodule DisablePluginsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
node = get_rabbit_hostname
node = get_rabbit_hostname()
:net_kernel.connect_node(node)
{:ok, plugins_file} = :rabbit_misc.rpc_call(node,
:application, :get_env,
@ -44,7 +44,7 @@ defmodule DisablePluginsCommandTest do
all: false}
on_exit(fn ->
set_enabled_plugins(enabled_plugins, :online, get_rabbit_hostname, opts)
set_enabled_plugins(enabled_plugins, :online, get_rabbit_hostname(), opts)
end)
:erlang.disconnect_node(node)
@ -54,20 +54,20 @@ defmodule DisablePluginsCommandTest do
end
setup context do
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
set_enabled_plugins([:rabbitmq_stomp, :rabbitmq_federation],
:online,
get_rabbit_hostname,
get_rabbit_hostname(),
context[:opts])
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
{
:ok,
opts: Map.merge(context[:opts], %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
})
}
end

View File

@ -25,7 +25,7 @@ defmodule EnablePluginsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
node = get_rabbit_hostname
node = get_rabbit_hostname()
:net_kernel.connect_node(node)
{:ok, plugins_file} = :rabbit_misc.rpc_call(node,
:application, :get_env,
@ -44,7 +44,7 @@ defmodule EnablePluginsCommandTest do
all: false}
on_exit(fn ->
set_enabled_plugins(enabled_plugins, :online, get_rabbit_hostname, opts)
set_enabled_plugins(enabled_plugins, :online, get_rabbit_hostname(), opts)
end)
:erlang.disconnect_node(node)
@ -54,20 +54,20 @@ defmodule EnablePluginsCommandTest do
end
setup context do
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
set_enabled_plugins([:rabbitmq_stomp, :rabbitmq_federation],
:online,
get_rabbit_hostname,
get_rabbit_hostname(),
context[:opts])
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
{
:ok,
opts: Map.merge(context[:opts], %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
})
}
end

View File

@ -28,7 +28,7 @@ defmodule ListPluginsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
node = get_rabbit_hostname
node = get_rabbit_hostname()
:net_kernel.connect_node(node)
{:ok, plugins_file} = :rabbit_misc.rpc_call(node,
:application, :get_env,
@ -47,7 +47,7 @@ defmodule ListPluginsCommandTest do
enabled: false, implicitly_enabled: false}
on_exit(fn ->
set_enabled_plugins(enabled_plugins, :online, get_rabbit_hostname, opts)
set_enabled_plugins(enabled_plugins, :online, get_rabbit_hostname(), opts)
end)
:erlang.disconnect_node(node)
@ -57,20 +57,20 @@ defmodule ListPluginsCommandTest do
end
setup context do
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
set_enabled_plugins([:rabbitmq_stomp, :rabbitmq_federation],
:online,
get_rabbit_hostname,
get_rabbit_hostname(),
context[:opts])
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
{
:ok,
opts: Map.merge(context[:opts], %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
})
}
end
@ -258,7 +258,7 @@ defmodule ListPluginsCommandTest do
opts = get_opts_with_plugins_directories(context, [plugins_directory_01])
switch_plugins_directories(context[:opts][:plugins_dir], opts[:plugins_dir])
set_enabled_plugins([:mock_rabbitmq_plugins_02, :rabbitmq_federation, :rabbitmq_stomp],
:online, get_rabbit_hostname, opts)
:online, get_rabbit_hostname(), opts)
assert %{status: :running,
plugins: [%{name: :amqp_client, enabled: :implicit, running: true},
%{name: :mock_rabbitmq_plugins_01, enabled: :not_enabled, running: false, version: '0.2.0'},

View File

@ -28,7 +28,7 @@ defmodule SetPluginsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
node = get_rabbit_hostname
node = get_rabbit_hostname()
:net_kernel.connect_node(node)
{:ok, plugins_file} = :rabbit_misc.rpc_call(node,
:application, :get_env,
@ -46,7 +46,7 @@ defmodule SetPluginsCommandTest do
online: true, offline: false}
on_exit(fn ->
set_enabled_plugins(enabled_plugins, :online, get_rabbit_hostname,opts)
set_enabled_plugins(enabled_plugins, :online, get_rabbit_hostname(),opts)
end)
:erlang.disconnect_node(node)
@ -56,20 +56,20 @@ defmodule SetPluginsCommandTest do
end
setup context do
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
set_enabled_plugins([:rabbitmq_stomp, :rabbitmq_federation],
:online,
get_rabbit_hostname,
get_rabbit_hostname(),
context[:opts])
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
{
:ok,
opts: Map.merge(context[:opts], %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
})
}
end
@ -162,7 +162,7 @@ defmodule SetPluginsCommandTest do
end
test "can set multiple plugins", context do
set_enabled_plugins([], :online, get_rabbit_hostname, context[:opts])
set_enabled_plugins([], :online, get_rabbit_hostname(), context[:opts])
assert {:stream, test_stream} =
@command.run(["rabbitmq_federation", "rabbitmq_stomp"], context[:opts])
assert [[:amqp_client, :rabbitmq_federation, :rabbitmq_stomp],

View File

@ -24,10 +24,10 @@ defmodule PurgeQueueCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -36,7 +36,7 @@ defmodule PurgeQueueCommandTest do
setup context do
{:ok, opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
vhost: @vhost,
timeout: context[:test_timeout]
}}

View File

@ -22,7 +22,7 @@ defmodule RenameClusterNodeCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
node = get_rabbit_hostname
node = get_rabbit_hostname()
:net_kernel.connect_node(node)
start_rabbitmq_app
@ -67,7 +67,7 @@ defmodule RenameClusterNodeCommandTest do
end
test "validate: request to a running node fails", _context do
node = get_rabbit_hostname
node = get_rabbit_hostname()
assert match?({:validation_failure, :node_running},
@command.validate([to_string(node), "other_node@localhost"], %{node: node}))
end

View File

@ -22,10 +22,10 @@ defmodule ReportTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -33,7 +33,7 @@ defmodule ReportTest do
end
setup do
{:ok, opts: %{node: get_rabbit_hostname, timeout: :infinity}}
{:ok, opts: %{node: get_rabbit_hostname(), timeout: :infinity}}
end
test "validate: with extra arguments, status returns an arg count error", context do
@ -54,6 +54,6 @@ defmodule ReportTest do
test "banner", context do
assert @command.banner([], context[:opts])
=~ ~r/Reporting server status of node #{get_rabbit_hostname}/
=~ ~r/Reporting server status of node #{get_rabbit_hostname()}/
end
end

View File

@ -22,13 +22,13 @@ defmodule ResetCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
start_rabbitmq_app
on_exit([], fn ->
start_rabbitmq_app
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -36,7 +36,7 @@ defmodule ResetCommandTest do
end
setup do
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate: with extra arguments returns an arg count error", context do
@ -69,7 +69,7 @@ defmodule ResetCommandTest do
end
test "banner", context do
assert @command.banner([], context[:opts]) =~ ~r/Resetting node #{get_rabbit_hostname}/
assert @command.banner([], context[:opts]) =~ ~r/Resetting node #{get_rabbit_hostname()}/
end
test "output mnesia is running error", context do

View File

@ -22,10 +22,10 @@ defmodule RotateLogsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -33,7 +33,7 @@ defmodule RotateLogsCommandTest do
end
setup do
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate: with extra arguments returns an arg count error", context do
@ -52,6 +52,6 @@ defmodule RotateLogsCommandTest do
end
test "banner", context do
assert @command.banner([], context[:opts]) =~ ~r/Rotating logs for node #{get_rabbit_hostname}/
assert @command.banner([], context[:opts]) =~ ~r/Rotating logs for node #{get_rabbit_hostname()}/
end
end

View File

@ -8,10 +8,10 @@ defmodule RpcStreamTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)

View File

@ -22,10 +22,10 @@ defmodule SetClusterNameCommandTest do
setup_all do
:net_kernel.start([:rabbitmqctl, :shortnames])
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -33,7 +33,7 @@ defmodule SetClusterNameCommandTest do
end
setup do
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "shows up in help" do

View File

@ -24,12 +24,12 @@ defmodule SetDiskFreeLimitCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
set_disk_free_limit(@default_limit)
on_exit([], fn ->
set_disk_free_limit(@default_limit)
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -39,7 +39,7 @@ defmodule SetDiskFreeLimitCommandTest do
context[:tag] # silences warnings
on_exit([], fn -> set_disk_free_limit(@default_limit) end)
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate: an invalid number of arguments results in arg count errors" do
@ -162,23 +162,23 @@ defmodule SetDiskFreeLimitCommandTest do
test "banner: returns absolute message", context do
assert @command.banner(["10"], context[:opts])
=~ ~r/Setting disk free limit on #{get_rabbit_hostname} to 10 bytes .../
=~ ~r/Setting disk free limit on #{get_rabbit_hostname()} to 10 bytes .../
assert @command.banner(["-10"], context[:opts])
=~ ~r/Setting disk free limit on #{get_rabbit_hostname} to -10 bytes .../
=~ ~r/Setting disk free limit on #{get_rabbit_hostname()} to -10 bytes .../
assert @command.banner(["sandwich"], context[:opts])
=~ ~r/Setting disk free limit on #{get_rabbit_hostname} to sandwich bytes .../
=~ ~r/Setting disk free limit on #{get_rabbit_hostname()} to sandwich bytes .../
end
test "banner: returns memory-relative message", context do
assert @command.banner(["mem_relative", "1.3"], context[:opts])
=~ ~r/Setting disk free limit on #{get_rabbit_hostname} to 1\.3 times the total RAM \.\.\./
=~ ~r/Setting disk free limit on #{get_rabbit_hostname()} to 1\.3 times the total RAM \.\.\./
assert @command.banner(["mem_relative", "-1.3"], context[:opts])
=~ ~r/Setting disk free limit on #{get_rabbit_hostname} to -1\.3 times the total RAM \.\.\./
=~ ~r/Setting disk free limit on #{get_rabbit_hostname()} to -1\.3 times the total RAM \.\.\./
assert @command.banner(["mem_relative", "sandwich"], context[:opts])
=~ ~r/Setting disk free limit on #{get_rabbit_hostname} to sandwich times the total RAM \.\.\./
=~ ~r/Setting disk free limit on #{get_rabbit_hostname()} to sandwich times the total RAM \.\.\./
end
end

View File

@ -25,10 +25,10 @@ defmodule SetGlobalParameterCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
:ok
@ -42,7 +42,7 @@ defmodule SetGlobalParameterCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
}
}
end

View File

@ -31,13 +31,13 @@ defmodule SetOperatorPolicyCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_vhost @vhost
on_exit([], fn ->
delete_vhost @vhost
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -53,7 +53,7 @@ defmodule SetOperatorPolicyCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
vhost: "/",
apply_to: @apply_to,
priority: @priority

View File

@ -29,7 +29,7 @@ defmodule SetParameterCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_vhost @vhost
@ -37,7 +37,7 @@ defmodule SetParameterCommandTest do
on_exit([], fn ->
delete_vhost @vhost
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -53,7 +53,7 @@ defmodule SetParameterCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
vhost: "/"
}
}

View File

@ -26,13 +26,13 @@ defmodule SetPermissionsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_vhost @vhost
on_exit([], fn ->
delete_vhost @vhost
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -48,7 +48,7 @@ defmodule SetPermissionsCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
vhost: context[:vhost]
}
}

View File

@ -31,7 +31,7 @@ defmodule SetPolicyCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_vhost @vhost
@ -39,7 +39,7 @@ defmodule SetPolicyCommandTest do
on_exit([], fn ->
delete_vhost @vhost
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -55,7 +55,7 @@ defmodule SetPolicyCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
vhost: "/",
apply_to: @apply_to,
priority: @priority

View File

@ -26,13 +26,13 @@ defmodule SetTopicPermissionsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_vhost @vhost
on_exit([], fn ->
delete_vhost @vhost
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -48,7 +48,7 @@ defmodule SetTopicPermissionsCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
vhost: context[:vhost]
}
}

View File

@ -25,12 +25,12 @@ defmodule SetUserTagsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_user @user, @password
on_exit([], fn ->
delete_user(@user)
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -41,7 +41,7 @@ defmodule SetUserTagsCommandTest do
context[:user] # silences warnings
on_exit([], fn -> set_user_tags(context[:user], []) end)
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate: on an incorrect number of arguments, return an arg count error" do

View File

@ -27,13 +27,13 @@ defmodule SetVhostLimitsCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_vhost @vhost
on_exit([], fn ->
delete_vhost @vhost
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -53,7 +53,7 @@ defmodule SetVhostLimitsCommandTest do
{
:ok,
opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
vhost: vhost
},
definition: context[:definition] || @definition,

View File

@ -23,17 +23,17 @@ defmodule SetVmMemoryHighWatermarkCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
reset_vm_memory_high_watermark()
on_exit([], fn ->
reset_vm_memory_high_watermark()
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate: a string returns an error", context do
@ -149,23 +149,23 @@ defmodule SetVmMemoryHighWatermarkCommandTest do
test "banner: absolute memory request prints info message", context do
assert @command.banner(["absolute", "10"], context[:opts])
=~ ~r/Setting memory threshold on #{get_rabbit_hostname} to 10 bytes .../
=~ ~r/Setting memory threshold on #{get_rabbit_hostname()} to 10 bytes .../
assert @command.banner(["absolute", "-10"], context[:opts])
=~ ~r/Setting memory threshold on #{get_rabbit_hostname} to -10 bytes .../
=~ ~r/Setting memory threshold on #{get_rabbit_hostname()} to -10 bytes .../
assert @command.banner(["absolute", "sandwich"], context[:opts])
=~ ~r/Setting memory threshold on #{get_rabbit_hostname} to sandwich bytes .../
=~ ~r/Setting memory threshold on #{get_rabbit_hostname()} to sandwich bytes .../
end
test "banner, relative memory", context do
assert @command.banner(["0.7"], context[:opts])
=~ ~r/Setting memory threshold on #{get_rabbit_hostname} to 0.7 .../
=~ ~r/Setting memory threshold on #{get_rabbit_hostname()} to 0.7 .../
assert @command.banner(["-0.7"], context[:opts])
=~ ~r/Setting memory threshold on #{get_rabbit_hostname} to -0.7 .../
=~ ~r/Setting memory threshold on #{get_rabbit_hostname()} to -0.7 .../
assert @command.banner(["sandwich"], context[:opts])
=~ ~r/Setting memory threshold on #{get_rabbit_hostname} to sandwich .../
=~ ~r/Setting memory threshold on #{get_rabbit_hostname()} to sandwich .../
end
end

View File

@ -22,13 +22,13 @@ defmodule StartAppCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
start_rabbitmq_app
on_exit([], fn ->
start_rabbitmq_app
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -36,7 +36,7 @@ defmodule StartAppCommandTest do
end
setup do
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate: with extra arguments returns an arg count error", context do
@ -59,6 +59,6 @@ defmodule StartAppCommandTest do
end
test "banner", context do
assert @command.banner([], context[:opts]) =~ ~r/Starting node #{get_rabbit_hostname}/
assert @command.banner([], context[:opts]) =~ ~r/Starting node #{get_rabbit_hostname()}/
end
end

View File

@ -22,10 +22,10 @@ defmodule StatusCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -33,7 +33,7 @@ defmodule StatusCommandTest do
end
setup do
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate: with extra arguments returns an arg count error", context do
@ -52,6 +52,6 @@ defmodule StatusCommandTest do
end
test "banner", context do
assert @command.banner([], context[:opts]) =~ ~r/Status of node #{get_rabbit_hostname}/
assert @command.banner([], context[:opts]) =~ ~r/Status of node #{get_rabbit_hostname()}/
end
end

View File

@ -22,13 +22,13 @@ defmodule StopAppCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
start_rabbitmq_app
on_exit([], fn ->
start_rabbitmq_app
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -36,7 +36,7 @@ defmodule StopAppCommandTest do
end
setup do
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate: with extra arguments returns an arg count error", context do
@ -58,6 +58,6 @@ defmodule StopAppCommandTest do
end
test "banner", context do
assert @command.banner([], context[:opts]) =~ ~r/Stopping rabbit application on node #{get_rabbit_hostname}/
assert @command.banner([], context[:opts]) =~ ~r/Stopping rabbit application on node #{get_rabbit_hostname()}/
end
end

View File

@ -22,10 +22,10 @@ defmodule StopCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -33,7 +33,7 @@ defmodule StopCommandTest do
end
setup do
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate accepts no arguments", context do
@ -58,6 +58,6 @@ defmodule StopCommandTest do
end
test "banner", context do
assert @command.banner([], context[:opts]) =~ ~r/Stopping and halting node #{get_rabbit_hostname}/
assert @command.banner([], context[:opts]) =~ ~r/Stopping and halting node #{get_rabbit_hostname()}/
end
end

View File

@ -23,13 +23,13 @@ defmodule SyncQueueCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
start_rabbitmq_app
on_exit([], fn ->
start_rabbitmq_app
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -38,7 +38,7 @@ defmodule SyncQueueCommandTest do
setup do
{:ok, opts: %{
node: get_rabbit_hostname,
node: get_rabbit_hostname(),
vhost: @vhost
}}
end

View File

@ -23,7 +23,7 @@ defmodule TestHelper do
alias RabbitMQ.CLI.Core.CommandModules, as: CommandModules
def get_rabbit_hostname() do
RabbitMQ.CLI.Core.Helpers.get_rabbit_hostname
RabbitMQ.CLI.Core.Helpers.get_rabbit_hostname()
end
def hostname() do
@ -39,134 +39,134 @@ defmodule TestHelper do
end
def get_cluster_name() do
:rpc.call(get_rabbit_hostname, :rabbit_nodes, :cluster_name, [])
:rpc.call(get_rabbit_hostname(), :rabbit_nodes, :cluster_name, [])
end
def add_vhost(name) do
:rpc.call(get_rabbit_hostname, :rabbit_vhost, :add, [name, "acting-user"])
:rpc.call(get_rabbit_hostname(), :rabbit_vhost, :add, [name, "acting-user"])
end
def delete_vhost(name) do
:rpc.call(get_rabbit_hostname, :rabbit_vhost, :delete, [name, "acting-user"])
:rpc.call(get_rabbit_hostname(), :rabbit_vhost, :delete, [name, "acting-user"])
end
def list_vhosts() do
:rpc.call(get_rabbit_hostname, :rabbit_vhost, :info_all, [])
:rpc.call(get_rabbit_hostname(), :rabbit_vhost, :info_all, [])
end
def add_user(name, password) do
:rpc.call(get_rabbit_hostname, :rabbit_auth_backend_internal, :add_user,
:rpc.call(get_rabbit_hostname(), :rabbit_auth_backend_internal, :add_user,
[name, password, "acting-user"])
end
def delete_user(name) do
:rpc.call(get_rabbit_hostname, :rabbit_auth_backend_internal, :delete_user,
:rpc.call(get_rabbit_hostname(), :rabbit_auth_backend_internal, :delete_user,
[name, "acting-user"])
end
def list_users() do
:rpc.call(get_rabbit_hostname, :rabbit_auth_backend_internal, :list_users, [])
:rpc.call(get_rabbit_hostname(), :rabbit_auth_backend_internal, :list_users, [])
end
def trace_on(vhost) do
:rpc.call(get_rabbit_hostname, :rabbit_trace, :start, [vhost])
:rpc.call(get_rabbit_hostname(), :rabbit_trace, :start, [vhost])
end
def trace_off(vhost) do
:rpc.call(get_rabbit_hostname, :rabbit_trace, :stop, [vhost])
:rpc.call(get_rabbit_hostname(), :rabbit_trace, :stop, [vhost])
end
def set_user_tags(name, tags) do
:rpc.call(get_rabbit_hostname, :rabbit_auth_backend_internal, :set_tags,
:rpc.call(get_rabbit_hostname(), :rabbit_auth_backend_internal, :set_tags,
[name, tags, "acting-user"])
end
def authenticate_user(name, password) do
:rpc.call(get_rabbit_hostname, :rabbit_access_control,:check_user_pass_login, [name, password])
:rpc.call(get_rabbit_hostname(), :rabbit_access_control,:check_user_pass_login, [name, password])
end
def set_parameter(vhost, component_name, key, value) do
:ok = :rpc.call(get_rabbit_hostname, :rabbit_runtime_parameters, :parse_set, [vhost, component_name, key, value, :nouser])
:ok = :rpc.call(get_rabbit_hostname(), :rabbit_runtime_parameters, :parse_set, [vhost, component_name, key, value, :nouser])
end
def clear_parameter(vhost, component_name, key) do
:rpc.call(get_rabbit_hostname, :rabbit_runtime_parameters, :clear, [vhost, component_name, key, <<"acting-user">>])
:rpc.call(get_rabbit_hostname(), :rabbit_runtime_parameters, :clear, [vhost, component_name, key, <<"acting-user">>])
end
def list_parameters(vhost) do
:rpc.call(get_rabbit_hostname, :rabbit_runtime_parameters, :list_formatted, [vhost])
:rpc.call(get_rabbit_hostname(), :rabbit_runtime_parameters, :list_formatted, [vhost])
end
def set_global_parameter(key, value) do
:ok = :rpc.call(get_rabbit_hostname, :rabbit_runtime_parameters, :parse_set_global,
:ok = :rpc.call(get_rabbit_hostname(), :rabbit_runtime_parameters, :parse_set_global,
[key, value, "acting-user"])
end
def clear_global_parameter(key) do
:rpc.call(get_rabbit_hostname, :rabbit_runtime_parameters, :clear_global,
:rpc.call(get_rabbit_hostname(), :rabbit_runtime_parameters, :clear_global,
[key, "acting-user"])
end
def list_global_parameters() do
:rpc.call(get_rabbit_hostname, :rabbit_runtime_parameters, :list_global_formatted, [])
:rpc.call(get_rabbit_hostname(), :rabbit_runtime_parameters, :list_global_formatted, [])
end
def set_permissions(user, vhost, [conf, write, read]) do
:rpc.call(get_rabbit_hostname, :rabbit_auth_backend_internal, :set_permissions, [user, vhost, conf, write, read, "acting-user"])
:rpc.call(get_rabbit_hostname(), :rabbit_auth_backend_internal, :set_permissions, [user, vhost, conf, write, read, "acting-user"])
end
def list_policies(vhost) do
:rpc.call(get_rabbit_hostname, :rabbit_policy, :list_formatted, [vhost])
:rpc.call(get_rabbit_hostname(), :rabbit_policy, :list_formatted, [vhost])
end
def set_policy(vhost, name, pattern, value) do
{:ok, decoded} = :rabbit_json.try_decode(value)
parsed = :maps.to_list(decoded)
:ok = :rpc.call(get_rabbit_hostname, :rabbit_policy, :set, [vhost, name, pattern, parsed, 0, "all", "acting-user"])
:ok = :rpc.call(get_rabbit_hostname(), :rabbit_policy, :set, [vhost, name, pattern, parsed, 0, "all", "acting-user"])
end
def clear_policy(vhost, key) do
:rpc.call(get_rabbit_hostname, :rabbit_policy, :delete, [vhost, key, "acting-user"])
:rpc.call(get_rabbit_hostname(), :rabbit_policy, :delete, [vhost, key, "acting-user"])
end
def list_operator_policies(vhost) do
:rpc.call(get_rabbit_hostname, :rabbit_policy, :list_formatted_op, [vhost])
:rpc.call(get_rabbit_hostname(), :rabbit_policy, :list_formatted_op, [vhost])
end
def set_operator_policy(vhost, name, pattern, value) do
{:ok, decoded} = :rabbit_json.try_decode(value)
parsed = :maps.to_list(decoded)
:ok = :rpc.call(get_rabbit_hostname, :rabbit_policy, :set_op, [vhost, name, pattern, parsed, 0, "all", "acting-user"])
:ok = :rpc.call(get_rabbit_hostname(), :rabbit_policy, :set_op, [vhost, name, pattern, parsed, 0, "all", "acting-user"])
end
def clear_operator_policy(vhost, key) do
:rpc.call(get_rabbit_hostname, :rabbit_policy, :delete_op, [vhost, key, "acting-user"])
:rpc.call(get_rabbit_hostname(), :rabbit_policy, :delete_op, [vhost, key, "acting-user"])
end
def declare_queue(name, vhost, durable \\ false, auto_delete \\ false, args \\ [], owner \\ :none) do
queue_name = :rabbit_misc.r(vhost, :queue, name)
:rpc.call(get_rabbit_hostname,
:rpc.call(get_rabbit_hostname(),
:rabbit_amqqueue, :declare,
[queue_name, durable, auto_delete, args, owner, "acting-user"])
end
def delete_queue(name, vhost) do
queue_name = :rabbit_misc.r(vhost, :queue, name)
:rpc.call(get_rabbit_hostname,
:rpc.call(get_rabbit_hostname(),
:rabbit_amqqueue, :delete,
[queue_name, false, false, "acting-user"])
end
def declare_exchange(name, vhost, type \\ :direct, durable \\ false, auto_delete \\ false, internal \\ false, args \\ []) do
exchange_name = :rabbit_misc.r(vhost, :exchange, name)
:rpc.call(get_rabbit_hostname,
:rpc.call(get_rabbit_hostname(),
:rabbit_exchange, :declare,
[exchange_name, type, durable, auto_delete, internal, args, "acting-user"])
end
def list_permissions(vhost) do
:rpc.call(
get_rabbit_hostname,
get_rabbit_hostname(),
:rabbit_auth_backend_internal,
:list_vhost_permissions,
[vhost],
@ -176,7 +176,7 @@ defmodule TestHelper do
def set_topic_permissions(user, vhost, exchange, pattern) do
:rpc.call(
get_rabbit_hostname,
get_rabbit_hostname(),
:rabbit_auth_backend_internal,
:set_topic_permissions,
[user, vhost, exchange, pattern, "acting-user"],
@ -186,7 +186,7 @@ defmodule TestHelper do
def list_user_topic_permissions(user) do
:rpc.call(
get_rabbit_hostname,
get_rabbit_hostname(),
:rabbit_auth_backend_internal,
:list_user_topic_permissions,
[user],
@ -196,7 +196,7 @@ defmodule TestHelper do
def clear_topic_permissions(user, vhost) do
:rpc.call(
get_rabbit_hostname,
get_rabbit_hostname(),
:rabbit_auth_backend_internal,
:clear_topic_permissions,
[user, vhost, "acting-user"],
@ -205,25 +205,25 @@ defmodule TestHelper do
end
def set_vm_memory_high_watermark(limit) do
:rpc.call(get_rabbit_hostname, :vm_memory_monitor, :set_vm_memory_high_watermark, [limit])
:rpc.call(get_rabbit_hostname(), :vm_memory_monitor, :set_vm_memory_high_watermark, [limit])
end
def set_disk_free_limit(limit) do
:rpc.call(get_rabbit_hostname, :rabbit_disk_monitor, :set_disk_free_limit, [limit])
:rpc.call(get_rabbit_hostname(), :rabbit_disk_monitor, :set_disk_free_limit, [limit])
end
def start_rabbitmq_app do
:rabbit_misc.rpc_call(get_rabbit_hostname, :rabbit, :start, [])
:rabbit_misc.rpc_call(get_rabbit_hostname(), :rabbit, :start, [])
:timer.sleep(1000)
end
def stop_rabbitmq_app do
:rabbit_misc.rpc_call(get_rabbit_hostname, :rabbit, :stop, [])
:rabbit_misc.rpc_call(get_rabbit_hostname(), :rabbit, :stop, [])
:timer.sleep(1000)
end
def status do
:rpc.call(get_rabbit_hostname, :rabbit, :status, [])
:rpc.call(get_rabbit_hostname(), :rabbit, :status, [])
end
def error_check(cmd_line, code) do
@ -316,7 +316,7 @@ defmodule TestHelper do
for q <- qs do
try do
:rpc.call(
get_rabbit_hostname,
get_rabbit_hostname(),
:rabbit_amqeueue,
:delete,
[q, false, false],
@ -331,7 +331,7 @@ defmodule TestHelper do
def reset_vm_memory_high_watermark() do
try do
:rpc.call(
get_rabbit_hostname,
get_rabbit_hostname(),
:vm_memory_monitor,
:set_vm_memory_high_watermark,
[0.4],
@ -378,7 +378,7 @@ defmodule TestHelper do
end
def enable_federation_plugin() do
node = get_rabbit_hostname
node = get_rabbit_hostname()
{:ok, plugins_file} = :rabbit_misc.rpc_call(node,
:application, :get_env,
[:rabbit, :enabled_plugins_file])
@ -397,21 +397,21 @@ defmodule TestHelper do
case Enum.member?(plugins, :rabbitmq_federation) do
true -> :ok
false ->
set_enabled_plugins(plugins ++ [:rabbitmq_federation], :online, get_rabbit_hostname, opts)
set_enabled_plugins(plugins ++ [:rabbitmq_federation], :online, get_rabbit_hostname(), opts)
end
end
def set_vhost_limits(vhost, limits) do
:rpc.call(get_rabbit_hostname,
:rpc.call(get_rabbit_hostname(),
:rabbit_vhost_limit, :parse_set, [vhost, limits, <<"acting-user">>])
end
def get_vhost_limits(vhost) do
:rpc.call(get_rabbit_hostname, :rabbit_vhost_limit, :list, [vhost])
:rpc.call(get_rabbit_hostname(), :rabbit_vhost_limit, :list, [vhost])
|> Map.new
end
def clear_vhost_limits(vhost) do
:rpc.call(get_rabbit_hostname, :rabbit_vhost_limit, :clear, [vhost, <<"acting-user">>])
:rpc.call(get_rabbit_hostname(), :rabbit_vhost_limit, :clear, [vhost, <<"acting-user">>])
end
def set_scope(scope) do

View File

@ -25,12 +25,12 @@ defmodule TraceOffCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_vhost(@test_vhost)
on_exit([], fn ->
delete_vhost(@test_vhost)
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -40,7 +40,7 @@ defmodule TraceOffCommandTest do
setup context do
trace_on(context[:vhost])
on_exit(context, fn -> trace_off(context[:vhost]) end)
{:ok, opts: %{node: get_rabbit_hostname, vhost: context[:vhost]}}
{:ok, opts: %{node: get_rabbit_hostname(), vhost: context[:vhost]}}
end
test "merge_defaults: defaults can be overridden" do
@ -53,8 +53,8 @@ defmodule TraceOffCommandTest do
end
test "run: on an active node, trace_off command works on default" do
opts = %{node: get_rabbit_hostname}
opts_with_vhost = %{node: get_rabbit_hostname, vhost: "/"}
opts = %{node: get_rabbit_hostname()}
opts_with_vhost = %{node: get_rabbit_hostname(), vhost: "/"}
trace_on(@default_vhost)
assert @command.merge_defaults([], opts) == {[], opts_with_vhost}
@ -67,7 +67,7 @@ defmodule TraceOffCommandTest do
assert @command.run([], opts) == {:badrpc, :nodedown}
end
@tag target: get_rabbit_hostname, vhost: @default_vhost
@tag target: get_rabbit_hostname(), vhost: @default_vhost
test "run: calls to trace_off are idempotent", context do
@command.run([], context[:opts])
assert @command.run([], context[:opts]) == :ok

View File

@ -25,12 +25,12 @@ defmodule TraceOnCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
add_vhost(@test_vhost)
on_exit([], fn ->
delete_vhost(@test_vhost)
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -39,12 +39,12 @@ defmodule TraceOnCommandTest do
setup context do
on_exit(context, fn -> trace_off(context[:vhost]) end)
{:ok, opts: %{node: get_rabbit_hostname, vhost: context[:vhost]}}
{:ok, opts: %{node: get_rabbit_hostname(), vhost: context[:vhost]}}
end
test "merge_defaults: on an active node, trace_on command works on default" do
opts = %{node: get_rabbit_hostname}
opts_with_vhost = %{node: get_rabbit_hostname, vhost: "/"}
opts = %{node: get_rabbit_hostname()}
opts_with_vhost = %{node: get_rabbit_hostname(), vhost: "/"}
assert @command.merge_defaults([], opts) == {[], opts_with_vhost}

View File

@ -22,13 +22,13 @@ defmodule UpdateClusterNodesCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
start_rabbitmq_app
on_exit([], fn ->
start_rabbitmq_app
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -37,7 +37,7 @@ defmodule UpdateClusterNodesCommandTest do
setup do
{:ok, opts: %{
node: get_rabbit_hostname
node: get_rabbit_hostname()
}}
end
@ -83,7 +83,7 @@ defmodule UpdateClusterNodesCommandTest do
test "banner", context do
assert @command.banner(["a"], context[:opts]) =~
~r/Will seed #{get_rabbit_hostname} from a on next start/
~r/Will seed #{get_rabbit_hostname()} from a on next start/
end
test "output mnesia is running error", context do

View File

@ -22,10 +22,10 @@ defmodule WaitCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
:net_kernel.connect_node(get_rabbit_hostname)
:net_kernel.connect_node(get_rabbit_hostname())
on_exit([], fn ->
:erlang.disconnect_node(get_rabbit_hostname)
:erlang.disconnect_node(get_rabbit_hostname())
end)
@ -33,7 +33,7 @@ defmodule WaitCommandTest do
end
setup do
{:ok, opts: %{node: get_rabbit_hostname}}
{:ok, opts: %{node: get_rabbit_hostname()}}
end
test "validate: with extra arguments returns an arg count error", context do
@ -42,7 +42,7 @@ defmodule WaitCommandTest do
end
test "banner", context do
assert @command.banner([], context[:opts]) =~ ~r/Waiting for node #{get_rabbit_hostname}/
assert @command.banner([], context[:opts]) =~ ~r/Waiting for node #{get_rabbit_hostname()}/
end
test "output: process not running error", context do