Update :badrpc test cases to be more resilient (part 2)

On some networks the response is a timeout, not a nodedown. That's
acceptable for this test.
This commit is contained in:
Michael Klishin 2019-04-12 02:27:15 +04:00
parent 60fc0ee25c
commit 66d6cf1173
81 changed files with 172 additions and 300 deletions

View File

@ -48,11 +48,9 @@ defmodule AddUserCommandTest do
end
@tag user: "someone", password: "password"
test "run: request to a non-existent node returns nodedown", context do
target = :jake@thedog
opts = %{node: target}
assert match?({:badrpc, :nodedown}, @command.run([context[:user], context[:password]], opts))
test "run: request to a non-existent node returns a badrpc", context do
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run([context[:user], context[:password]], opts))
end
@tag user: "someone", password: "password"

View File

@ -49,8 +49,8 @@ defmodule AddVhostCommandTest do
end
test "run: attempt to use an unreachable node returns a nodedown" do
opts = %{node: :jake@thedog, timeout: 3000}
assert @command.run(["na"], opts) == {:badrpc, :nodedown}
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run(["na"], opts))
end
test "run: adding the same host twice is idempotent", context do

View File

@ -51,10 +51,8 @@ defmodule AuthenticateUserCommandTest do
end
test "run: throws a badrpc when instructed to contact an unreachable RabbitMQ node" do
target = :jake@thedog
opts = %{node: target}
assert @command.run(["user", "password"], opts) == {:badrpc, :nodedown}
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run(["user", "password"], opts))
end
@tag user: @user, password: "treachery"

View File

@ -42,8 +42,8 @@ defmodule AwaitOnlineNodesCommandTest do
end
test "run: a call to an unreachable RabbitMQ node returns a nodedown" do
opts = %{node: :jake@thedog, timeout: 3000}
assert @command.run(["1"], opts) == {:badrpc, :nodedown}
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run(["1"], opts))
end
test "banner", context do

View File

@ -43,11 +43,9 @@ defmodule AwaitStartupCommandTest do
{:validation_failure, :too_many_args}
end
test "run: request to a non-existent node returns nodedown" do
target = :jake@thedog
opts = %{node: target, timeout: 5}
assert match?({:badrpc, :nodedown}, @command.run([], opts))
test "run: request to a non-existent node returns a badrpc" do
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run([], opts))
end
test "run: request to a fully booted node succeeds", context do

View File

@ -61,10 +61,8 @@ defmodule CancelSyncQueueCommandTest do
end
test "run: request to a non-existent RabbitMQ node returns a nodedown" do
target = :jake@thedog
opts = %{node: target, vhost: @vhost}
assert match?({:badrpc, :nodedown}, @command.run(["q1"], opts))
opts = %{node: :jake@thedog, vhost: @vhost, timeout: 200}
assert match?({:badrpc, _}, @command.run(["q1"], opts))
end
test "banner", context do

View File

@ -74,13 +74,8 @@ defmodule ChangeClusterNodeTypeCommandTest do
@command.run(["ram"], context[:opts]))
end
test "run: request to an unreachable node returns nodedown", _context do
target = :jake@thedog
opts = %{
node: target
}
# We use "self" node as the target. It's enough to trigger the error.
test "run: request to an unreachable node returns a badrpc", _context do
opts = %{node: :jake@thedog, timeout: 200}
assert match?(
{:badrpc, :nodedown},
@command.run(["ram"], opts))

View File

@ -49,10 +49,8 @@ defmodule ChangePasswordCommandTest do
end
test "run: throws a badrpc when instructed to contact an unreachable RabbitMQ node" do
target = :jake@thedog
opts = %{node: target}
assert @command.run(["user", "password"], opts) == {:badrpc, :nodedown}
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run(["user", "password"], opts))
end
@tag user: @user, password: @password

View File

@ -59,10 +59,8 @@ defmodule ClearGlobalParameterCommandTest do
end
test "run: throws a badrpc when instructed to contact an unreachable RabbitMQ node" do
target = :jake@thedog
opts = %{node: target}
assert @command.run([@key], opts) == {:badrpc, :nodedown}
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run([@key], opts))
end
@tag key: @key

View File

@ -84,10 +84,8 @@ defmodule ClearOperatorPolicyCommandTest do
end
test "run: an unreachable node throws a badrpc" do
target = :jake@thedog
opts = %{node: target, vhost: "/"}
assert @command.run([@key], opts) == {:badrpc, :nodedown}
opts = %{node: :jake@thedog, vhost: "/", timeout: 200}
assert match?({:badrpc, _}, @command.run([@key], opts))
end

View File

@ -82,10 +82,8 @@ defmodule ClearParameterCommandTest do
end
test "run: throws a badrpc when instructed to contact an unreachable RabbitMQ node" do
target = :jake@thedog
opts = %{node: target, vhost: "/"}
assert @command.run([@component_name, @key], opts) == {:badrpc, :nodedown}
opts = %{node: :jake@thedog, vhost: "/", timeout: 200}
assert match?({:badrpc, _}, @command.run([@component_name, @key], opts))
end

View File

@ -46,11 +46,8 @@ defmodule ClearPasswordCommandTest do
end
test "run: throws a badrpc when instructed to contact an unreachable RabbitMQ node" do
target = :jake@thedog
opts = %{node: target}
assert @command.run(["user"], opts) == {:badrpc, :nodedown}
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run(["user"], opts))
end
@tag user: "interloper"

View File

@ -72,11 +72,10 @@ defmodule ClearPermissionsTest do
end
test "run: on an invalid node, return a badrpc message" do
bad_node = :jake@thedog
arg = ["some_name"]
opts = %{node: bad_node, vhost: ""}
opts = %{node: :jake@thedog, vhost: "/", timeout: 200}
assert @command.run(arg, opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run(arg, opts))
end
@tag user: @user, vhost: @specific_vhost

View File

@ -86,10 +86,8 @@ defmodule ClearPolicyCommandTest do
end
test "run: an unreachable node throws a badrpc" do
target = :jake@thedog
opts = %{node: target, vhost: "/"}
assert @command.run([@key], opts) == {:badrpc, :nodedown}
opts = %{node: :jake@thedog, vhost: "/", timeout: 200}
assert match?({:badrpc, _}, @command.run([@key], opts))
end

View File

@ -85,11 +85,10 @@ defmodule ClearTopicPermissionsTest do
end
test "run: throws a badrpc when instructed to contact an unreachable RabbitMQ node" do
bad_node = :jake@thedog
arg = ["some_name"]
opts = %{node: bad_node, vhost: ""}
opts = %{node: :jake@thedog, vhost: "/", timeout: 200}
assert @command.run(arg, opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run(arg, opts))
end
@tag user: @user, vhost: @specific_vhost

View File

@ -68,10 +68,8 @@ defmodule ClearVhostLimitsCommandTest do
end
test "run: an unreachable node throws a badrpc" do
target = :jake@thedog
opts = %{node: target, vhost: "/"}
assert @command.run([], opts) == {:badrpc, :nodedown}
opts = %{node: :jake@thedog, vhost: "/", timeout: 200}
assert match?({:badrpc, _}, @command.run([], opts))
end

View File

@ -99,11 +99,9 @@ defmodule CloseAllConnectionsCommandTest do
end)
end
test "run: a close_all_connections request to non-existent RabbitMQ node returns nodedown" do
target = :jake@thedog
opts = %{node: target, vhost: @vhost, global: true, per_connection_delay: 0, limit: 0}
assert match?({:badrpc, :nodedown}, @command.run(["test"], opts))
test "run: a close_all_connections request to non-existent RabbitMQ node returns a badrpc" do
opts = %{node: :jake@thedog, vhost: @vhost, global: true, per_connection_delay: 0, limit: 0, timeout: 200}
assert match?({:badrpc, _}, @command.run(["test"], opts))
end
test "banner for vhost option", context do

View File

@ -68,11 +68,9 @@ defmodule CloseConnectionCommandTest do
@command.run(["<#{node()}.2.121.12>", "test"], %{node: @helpers.normalise_node(context[:node], :shortnames)}))
end
test "run: a close_connection request on nonexistent RabbitMQ node returns nodedown" do
target = :jake@thedog
opts = %{node: target}
assert match?({:badrpc, :nodedown}, @command.run(["<rabbit@localhost.1.2.1>", "test"], opts))
test "run: a close_connection request on nonexistent RabbitMQ node returns a badrpc" do
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run(["<rabbit@localhost.1.2.1>", "test"], opts))
end
test "banner", context do

View File

@ -41,12 +41,10 @@ defmodule ClusterStatusCommandTest do
assert @command.run([], context[:opts])[:nodes] != nil
end
test "run: status request on nonexistent RabbitMQ node returns nodedown" do
target = :jake@thedog
test "run: status request on nonexistent RabbitMQ node returns a badrpc" do
opts = %{node: :jake@thedog, timeout: 200}
opts = %{node: target}
assert @command.run([], opts) != nil
assert match?({:badrpc, _}, @command.run([], opts))
end
test "banner", context do

View File

@ -49,11 +49,9 @@ defmodule DeleteUserCommandTest do
end
test "run: An invalid Rabbit node returns a bad rpc message" do
target = :jake@thedog
opts = %{node: :jake@thedog, timeout: 200}
opts = %{node: target}
assert @command.run(["username"], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run(["username"], opts))
end
@tag user: @user

View File

@ -56,11 +56,9 @@ defmodule DeleteVhostCommandTest do
end
test "run: A call to invalid or inactive RabbitMQ node returns a nodedown" do
target = :jake@thedog
opts = %{node: :jake@thedog, timeout: 200}
opts = %{node: target}
assert @command.run(["na"], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run(["na"], opts))
end
@tag vhost: @vhost

View File

@ -45,8 +45,8 @@ defmodule EnableFeatureFlagCommandTest do
end
test "run: attempt to use an unreachable node returns a nodedown" do
opts = %{node: :jake@thedog, timeout: 3000}
assert @command.run(["na"], opts) == {:badrpc, :nodedown}
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run(["na"], opts))
end
test "run: enabling the same feature flag twice is idempotent", context do

View File

@ -42,12 +42,10 @@ defmodule EnvironmentCommandTest do
assert @command.run([], context[:opts])[:rabbit] != nil
end
test "run: environment request on nonexistent RabbitMQ node returns nodedown" do
target = :jake@thedog
test "run: environment request on nonexistent RabbitMQ node returns a badrpc" do
opts = %{node: :jake@thedog, timeout: 200}
opts = %{node: target}
assert @command.run([], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], opts))
end
test "banner", context do

View File

@ -44,13 +44,10 @@ defmodule EvalCommandTest do
assert @command.validate(["foo bar", "foo"], %{}) == {:validation_failure, "syntax error before: bar"}
end
test "run: request to a non-existent node returns nodedown", _context do
target = :jake@thedog
test "run: request to a non-existent node returns a badrpc", _context do
opts = %{node: :jake@thedog, timeout: 200}
opts = %{node: target}
assert @command.run(["ok."], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run(["ok."], opts))
end
test "run: evaluates provided Erlang expression", context do

View File

@ -33,7 +33,7 @@ defmodule ForceGcCommandTest do
end
setup do
{:ok, opts: %{node: get_rabbit_hostname(), timeout: 70000}}
{:ok, opts: %{node: get_rabbit_hostname(), timeout: 200}}
end
@ -45,10 +45,8 @@ defmodule ForceGcCommandTest do
assert @command.validate(["extra"], context[:opts]) == {:validation_failure, :too_many_args}
end
test "run: request to a non-existent node returns nodedown" do
target = :jake@thedog
assert match?({:badrpc, _}, @command.run([], %{node: target, timeout: 70000}))
test "run: request to a non-existent node returns a badrpc" do
assert match?({:badrpc, _}, @command.run([], %{node: :jake@thedog, timeout: 200}))
end
test "run: request to a named, active node succeeds", context do

View File

@ -58,10 +58,8 @@ defmodule ForceResetCommandTest do
assert vhost_exists? "some_vhost"
end
test "run: request to a non-existent node returns nodedown" do
target = :jake@thedog
opts = %{node: target}
test "run: request to a non-existent node returns a badrpc" do
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run([], opts))
end

View File

@ -96,7 +96,7 @@ defmodule ForgetClusterNodeCommandTest do
@command.validate_execution_environment(["other_node@localhost"], opts_without_mnesia))
end
test "run: online request to a non-existent node returns nodedown", context do
test "run: online request to a non-existent node returns a badrpc", context do
assert match?(
{:badrpc, :nodedown},
@command.run([context[:opts][:node]],

View File

@ -81,27 +81,23 @@ defmodule JoinClusterCommandTest do
@command.run([context[:opts][:node]], context[:opts]))
end
test "run: request to a non-existent node returns nodedown", context do
target = :jake@thedog
test "run: request to a non-existent node returns a badrpc", context do
opts = %{
node: target,
node: :jake@thedog,
disc: true,
ram: false,
timeout: 200
}
# We use "self" node as the target. It's enough to trigger the error.
assert match?(
{:badrpc, :nodedown},
{:badrpc, _},
@command.run([context[:opts][:node]], opts))
end
test "run: joining a non-existent node returns nodedown", context do
target = :jake@thedog
test "run: joining a non-existent node returns a badrpc", context do
stop_rabbitmq_app()
assert match?(
{:badrpc_multi, :nodedown, [_]},
@command.run([target], context[:opts]))
{:badrpc_multi, _, [_]},
@command.run([:jake@thedog], context[:opts]))
start_rabbitmq_app()
end

View File

@ -73,9 +73,8 @@ defmodule ListFeatureFlagsCommandTest do
end
test "run: on a bad RabbitMQ node, return a badrpc" do
target = :jake@thedog
opts = %{node: target, timeout: :infinity}
assert @command.run(["name"], opts) == {:badrpc, :nodedown}
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run(["name"], opts))
end
@tag test_timeout: :infinity

View File

@ -77,11 +77,9 @@ defmodule ListOperatorPoliciesCommandTest do
end
test "run: an unreachable node throws a badrpc" do
target = :jake@thedog
opts = %{node: :jake@thedog, vhost: @vhost, timeout: 200}
opts = %{node: target, vhost: @vhost, timeout: :infinity}
assert @command.run([], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], opts))
end
@tag key: @key, pattern: @pattern, value: @value, vhost: @root

View File

@ -92,11 +92,9 @@ defmodule ListParametersCommandTest do
end
test "run: throws a badrpc when instructed to contact an unreachable RabbitMQ node" do
target = :jake@thedog
opts = %{node: :jake@thedog, vhost: @vhost, timeout: 200}
opts = %{node: target, vhost: @vhost, timeout: :infinity}
assert @command.run([], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], opts))
end
@tag component_name: @component_name, key: @key, value: @value, vhost: @root

View File

@ -65,10 +65,9 @@ defmodule ListPermissionsCommandTest do
end
test "run: on a bad RabbitMQ node, return a badrpc" do
target = :jake@thedog
opts = %{node: target, timeout: :infinity, vhost: "/"}
opts = %{node: :jake@thedog, vhost: "/", timeout: 200}
assert @command.run([], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], opts))
end
@tag test_timeout: @default_timeout, vhost: @vhost

View File

@ -80,11 +80,9 @@ defmodule ListPoliciesCommandTest do
end
test "run: an unreachable node throws a badrpc" do
target = :jake@thedog
opts = %{node: :jake@thedog, vhost: @vhost, timeout: 200}
opts = %{node: target, vhost: @vhost, timeout: :infinity}
assert @command.run([], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], opts))
end
@tag key: @key, pattern: @pattern, value: @value, vhost: @default_vhost

View File

@ -70,10 +70,9 @@ defmodule ListTopicPermissionsCommandTest do
end
test "run: throws a badrpc when instructed to contact an unreachable RabbitMQ node" do
target = :jake@thedog
opts = %{node: target, timeout: :infinity, vhost: "/"}
opts = %{node: :jake@thedog, vhost: "/", timeout: 200}
assert @command.run([], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], opts))
end
@tag test_timeout: @default_timeout, vhost: @vhost

View File

@ -74,7 +74,7 @@ defmodule ListUserPermissionsCommandTest do
## --------------------------------- Flags ------------------------------------
test "run: unreachable RabbitMQ node returns a badrpc" do
assert @command.run(["guest"], %{node: :jake@thedog, timeout: :infinity}) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run(["guest"], %{node: :jake@thedog, timeout: 200}))
end
@tag test_timeout: 30000, username: "guest"

View File

@ -71,11 +71,9 @@ defmodule ListUserTopicPermissionsCommandTest do
## --------------------------------- Flags ------------------------------------
test "run: throws a badrpc when instructed to contact an unreachable RabbitMQ node" do
target = :jake@thedog
opts = %{node: :jake@thedog, timeout: 200}
opts = %{node: target, timeout: :infinity}
assert @command.run(["guest"], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run(["guest"], opts))
end
@tag test_timeout: :infinity

View File

@ -57,7 +57,7 @@ defmodule ListUsersCommandTest do
end
test "run: On an invalid rabbitmq node, return a bad rpc" do
assert @command.run([], %{node: :jake@thedog, timeout: :infinity}) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], %{node: :jake@thedog, timeout: 200}))
end
@tag test_timeout: 30000
@ -82,4 +82,3 @@ defmodule ListUsersCommandTest do
=~ ~r/Listing users \.\.\./
end
end

View File

@ -98,11 +98,9 @@ defmodule ListVhostLimitsCommandTest do
end
test "run: an unreachable node throws a badrpc" do
target = :jake@thedog
opts = %{node: :jake@thedog, vhost: "/", timeout: 200}
opts = %{node: target, vhost: "/"}
assert @command.run([], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], opts))
end
@tag vhost: "bad-vhost"

View File

@ -103,10 +103,9 @@ defmodule ListVhostsCommandTest do
end
test "run: on a bad RabbitMQ node, return a badrpc" do
target = :jake@thedog
opts = %{node: target, timeout: :infinity}
opts = %{node: :jake@thedog, timeout: 200}
assert @command.run(["name"], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run(["name"], opts))
end
@tag test_timeout: :infinity

View File

@ -33,7 +33,7 @@ defmodule NodeHealthCheckCommandTest do
end
setup do
{:ok, opts: %{node: get_rabbit_hostname(), timeout: 70000}}
{:ok, opts: %{node: get_rabbit_hostname(), timeout: 200}}
end
test "validate: with extra arguments returns an arg count error", context do
@ -63,11 +63,8 @@ defmodule NodeHealthCheckCommandTest do
assert @command.run([], context[:opts]) == :ok
end
test "run: request to a non-existent node returns nodedown" do
target = :jake@thedog
assert match?({:badrpc, :nodedown}, @command.run([], %{node: target, timeout: 70000}))
test "run: request to a non-existent node returns a badrpc" do
assert match?({:badrpc, _}, @command.run([], %{node: :jake@thedog, timeout: 200}))
end
test "banner", context do

View File

@ -33,7 +33,7 @@ defmodule PingCommandTest do
end
setup do
{:ok, opts: %{node: get_rabbit_hostname(), timeout: 70000}}
{:ok, opts: %{node: get_rabbit_hostname(), timeout: 200}}
end
test "validate: with extra arguments returns an arg count error", context do
@ -52,10 +52,8 @@ defmodule PingCommandTest do
assert @command.run([], context[:opts])
end
test "run: request to a non-existent node returns nodedown" do
target = :jake@thedog
assert match?({:error, _}, @command.run([], %{node: target, timeout: 70000}))
test "run: request to a non-existent node returns a badrpc" do
assert match?({:error, _}, @command.run([], %{node: :jake@thedog, timeout: 200}))
end
test "banner", context do

View File

@ -41,10 +41,8 @@ defmodule ReportTest do
assert_stream_without_errors(output)
end
test "run: report request on nonexistent RabbitMQ node returns nodedown" do
target = :jake@thedog
opts = %{node: target}
test "run: report request on nonexistent RabbitMQ node returns a badrpc" do
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run([], opts))
end

View File

@ -23,13 +23,11 @@ defmodule ResetCommandTest do
setup_all do
RabbitMQ.CLI.Core.Distribution.start()
start_rabbitmq_app()
on_exit([], fn ->
start_rabbitmq_app()
end)
:ok
@ -61,11 +59,9 @@ defmodule ResetCommandTest do
assert vhost_exists? "some_vhost"
end
test "run: request to a non-existent node returns nodedown" do
target = :jake@thedog
opts = %{node: target}
assert match?({:badrpc, :nodedown}, @command.run([], opts))
test "run: request to a non-existent node returns a badrpc" do
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run([], opts))
end
test "banner", context do

View File

@ -45,13 +45,10 @@ defmodule RestartVhostCommandTest do
{:validation_failure, :too_many_args}
end
test "run: request to a non-existent node returns nodedown", _context do
target = :jake@thedog
opts = %{node: target, vhost: @vhost, timeout: @timeout}
# We use "self" node as the target. It's enough to trigger the error.
test "run: request to a non-existent node returns a badrpc", _context do
opts = %{node: :jake@thedog, vhost: @vhost, timeout: @timeout}
assert match?(
{:badrpc, :nodedown},
{:badrpc, _},
@command.run([], opts))
end

View File

@ -39,11 +39,9 @@ defmodule RotateLogsCommandTest do
assert @command.run([], context[:opts]) == :ok
end
test "run: request to a non-existent node returns nodedown" do
target = :jake@thedog
opts = %{node: target}
assert match?({:badrpc, :nodedown}, @command.run([], opts))
test "run: request to a non-existent node returns a badrpc" do
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run([], opts))
end
test "banner", context do

View File

@ -60,10 +60,9 @@ defmodule SetClusterNameCommandTest do
end
test "run: An invalid Rabbit node returns a bad rpc message" do
target = :jake@thedog
opts = %{node: target}
opts = %{node: :jake@thedog, timeout: 200}
assert @command.run(["clustername"], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run(["clustername"], opts))
end
test "banner shows that the name is being set" do

View File

@ -62,11 +62,9 @@ defmodule SetGlobalParameterCommandTest do
end
test "run: throws a badrpc when instructed to contact an unreachable RabbitMQ node" do
target = :jake@thedog
opts = %{node: :jake@thedog, timeout: 200}
opts = %{node: target}
assert @command.run([@key, @value], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([@key, @value], opts))
end
@tag key: @key, value: "bad-value"

View File

@ -42,10 +42,9 @@ defmodule SetLogLevelCommandTest do
assert @command.run([context[:log_level]], context[:opts]) == :ok
end
test "run: request to a non-existent node returns nodedown", context do
target = :jake@thedog
opts = %{node: target}
assert match?({:badrpc, :nodedown}, @command.run([context[:log_level]], opts))
test "run: request to a non-existent node returns a badrpc", context do
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run([context[:log_level]], opts))
end
test "banner", context do

View File

@ -102,11 +102,9 @@ defmodule SetOperatorPolicyCommandTest do
end
test "run: an unreachable node throws a badrpc" do
target = :jake@thedog
opts = %{node: :jake@thedog, vhost: "/", priority: 0, apply_to: "all", timeout: 200}
opts = %{node: target, vhost: "/", priority: 0, apply_to: "all"}
assert @command.run([@key, @pattern, @value], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([@key, @pattern, @value], opts))
end
@tag pattern: @pattern, key: @key, value: @value, vhost: "bad-vhost"

View File

@ -79,11 +79,9 @@ defmodule SetParameterCommandTest do
end
test "run: throws a badrpc when instructed to contact an unreachable RabbitMQ node" do
target = :jake@thedog
opts = %{node: :jake@thedog, vhost: "/", timeout: 200}
opts = %{node: target, vhost: "/"}
assert @command.run([@component_name, @key, @value], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([@component_name, @key, @value], opts))
end
@tag component_name: "bad-component-name", key: @key, value: @value, vhost: @root

View File

@ -81,11 +81,9 @@ defmodule SetPermissionsCommandTest do
end
test "run: throws a badrpc when instructed to contact an unreachable RabbitMQ node" do
target = :jake@thedog
opts = %{node: :jake@thedog, vhost: @vhost, timeout: 200}
opts = %{node: target, vhost: @vhost}
assert @command.run([@user, ".*", ".*", ".*"], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([@user, ".*", ".*", ".*"], opts))
end
@tag user: "interloper", vhost: @root

View File

@ -104,11 +104,9 @@ defmodule SetPolicyCommandTest do
end
test "run: an unreachable node throws a badrpc" do
target = :jake@thedog
opts = %{node: :jake@thedog, vhost: "/", priority: 0, apply_to: "all", timeout: 200}
opts = %{node: target, vhost: "/", priority: 0, apply_to: "all"}
assert @command.run([@key, @pattern, @value], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([@key, @pattern, @value], opts))
end
@tag pattern: @pattern, key: @key, value: @value, vhost: "bad-vhost"

View File

@ -81,11 +81,9 @@ defmodule SetTopicPermissionsCommandTest do
end
test "run: throws a badrpc when instructed to contact an unreachable RabbitMQ node" do
target = :jake@thedog
opts = %{node: :jake@thedog, vhost: @vhost, timeout: 200}
opts = %{node: target, vhost: @vhost}
assert @command.run([@user, "amq.topic", "^a", "^b"], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([@user, "amq.topic", "^a", "^b"], opts))
end
@tag user: "interloper", vhost: @root

View File

@ -49,11 +49,9 @@ defmodule SetUserTagsCommandTest do
end
test "run: throws a badrpc when instructed to contact an unreachable RabbitMQ node" do
target = :jake@thedog
opts = %{node: :jake@thedog, timeout: 200}
opts = %{node: target}
assert @command.run([@user, :imperator], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([@user, :imperator], opts))
end
@tag user: @user, tags: [:imperator]

View File

@ -87,11 +87,9 @@ defmodule SetVhostLimitsCommandTest do
end
test "run: an unreachable node throws a badrpc" do
target = :jake@thedog
opts = %{node: :jake@thedog, vhost: "/", timeout: 200}
opts = %{node: target, vhost: "/"}
assert @command.run([@definition], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([@definition], opts))
end
@tag vhost: "bad-vhost"

View File

@ -51,10 +51,8 @@ defmodule ShutdownCommandTest do
assert @command.validate([], Map.merge(%{wait: false}, context[:opts])) == :ok
end
test "run: request to a non-existent node returns nodedown" do
target = :jake@thedog
opts = %{node: target, wait: false, timeout: 1}
test "run: request to a non-existent node returns a badrpc" do
opts = %{node: :jake@thedog, wait: false, timeout: 200}
assert match?({:badrpc, _}, @command.run([], opts))
end

View File

@ -51,11 +51,9 @@ defmodule StartAppCommandTest do
assert :rabbit_misc.rpc_call(node, :rabbit, :is_running, [])
end
test "run: request to a non-existent node returns nodedown" do
target = :jake@thedog
opts = %{node: target}
assert match?({:badrpc, :nodedown}, @command.run([], opts))
test "run: request to a non-existent node returns a badrpc" do
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run([], opts))
end
test "banner", context do

View File

@ -38,11 +38,9 @@ defmodule StatusCommandTest do
assert @command.run([], context[:opts])[:pid] != nil
end
test "run: request to a non-existent node returns nodedown" do
target = :jake@thedog
opts = %{node: target, timeout: 60_000}
assert match?({:badrpc, :nodedown}, @command.run([], opts))
test "run: request to a non-existent node returns a badrpc" do
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run([], opts))
end
test "banner", context do

View File

@ -47,11 +47,9 @@ defmodule StopAppCommandTest do
refute :rabbit_misc.rpc_call(node, :rabbit, :is_running, [])
end
test "run: request to a non-existent node returns nodedown" do
target = :jake@thedog
opts = %{node: target}
assert match?({:badrpc, :nodedown}, @command.run([], opts))
test "run: request to a non-existent node returns a badrpc" do
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run([], opts))
end
test "banner", context do

View File

@ -45,17 +45,13 @@ defmodule StopCommandTest do
# NB: as this commands shuts down the Erlang vm it isn't really practical to test it here
test "run: request to a non-existent node with --idempotent=false returns nodedown" do
target = :jake@thedog
opts = %{node: target, idempotent: false}
assert match?({:badrpc, :nodedown}, @command.run([], opts))
test "run: request to a non-existent node with --idempotent=false returns a badrpc" do
opts = %{node: :jake@thedog, idempotent: false, timeout: 200}
assert match?({:badrpc, _}, @command.run([], opts))
end
test "run: request to a non-existent node with --idempotent returns ok" do
target = :jake@thedog
opts = %{node: target, idempotent: true}
opts = %{node: :jake@thedog, idempotent: true, timeout: 200}
assert match?({:ok, _}, @command.run([], opts))
end

View File

@ -63,10 +63,8 @@ defmodule SyncQueueCommandTest do
end
test "run: request to a non-existent RabbitMQ node returns a nodedown" do
target = :jake@thedog
opts = %{node: target, vhost: @vhost}
assert match?({:badrpc, :nodedown}, @command.run(["q1"], opts))
opts = %{node: :jake@thedog, vhost: @vhost, timeout: 200}
assert match?({:badrpc, _}, @command.run(["q1"], opts))
end
test "banner", context do

View File

@ -61,10 +61,8 @@ defmodule TraceOffCommandTest do
end
test "run: on an invalid RabbitMQ node, return a nodedown" do
target = :jake@thedog
opts = %{node: target, vhost: "/"}
assert @command.run([], opts) == {:badrpc, :nodedown}
opts = %{node: :jake@thedog, vhost: "/", timeout: 200}
assert match?({:badrpc, _}, @command.run([], opts))
end
@tag target: get_rabbit_hostname(), vhost: @default_vhost

View File

@ -61,11 +61,9 @@ defmodule TraceOnCommandTest do
end
test "run: on an invalid RabbitMQ node, return a nodedown" do
target = :jake@thedog
opts = %{node: :jake@thedog, vhost: "/", timeout: 200}
opts = %{node: target, vhost: "/"}
assert @command.run([], opts) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], opts))
end
@tag vhost: @default_vhost

View File

@ -59,25 +59,21 @@ defmodule UpdateClusterNodesCommandTest do
start_rabbitmq_app()
end
test "run: request to an unreachable node returns nodedown", context do
target = :jake@thedog
test "run: request to an unreachable node returns a badrpc", context do
opts = %{
node: target
node: :jake@thedog,
timeout: 200
}
# We use "self" node as the target. It's enough to trigger the error.
assert match?(
{:badrpc, :nodedown},
@command.run([context[:opts][:node]], opts))
end
test "run: specifying an unreachable node as seed returns nodedown", context do
target = :jake@thedog
test "run: specifying an unreachable node as seed returns a badrpc", context do
stop_rabbitmq_app()
assert match?(
{:badrpc_multi, :nodedown, [_]},
@command.run([target], context[:opts]))
{:badrpc_multi, _, [_]},
@command.run([:jake@thedog], context[:opts]))
start_rabbitmq_app()
end

View File

@ -53,7 +53,7 @@ defmodule CheckAlarmsCommandTest do
@tag test_timeout: 3000
test "run: targeting an unreachable node throws a badrpc", context do
assert @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})))
end
test "run: when target node has no alarms in effect, returns an empty list", context do

View File

@ -53,7 +53,7 @@ defmodule CheckLocalAlarmsCommandTest do
@tag test_timeout: 3000
test "run: targeting an unreachable node throws a badrpc", context do
assert @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})))
end
test "run: when target node has no alarms in effect, returns an empty list", context do

View File

@ -46,7 +46,7 @@ defmodule CheckPortConnectivityCommandTest do
@tag test_timeout: 3000
test "run: targeting an unreachable node throws a badrpc", context do
assert @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})))
end
test "run: tries to connect to every inferred active listener", context do

View File

@ -50,7 +50,7 @@ defmodule CheckPortListenerCommandTest do
@tag test_timeout: 3000
test "run: targeting an unreachable node throws a badrpc", context do
assert @command.run([61613], Map.merge(context[:opts], %{node: :jake@thedog})) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([61613], Map.merge(context[:opts], %{node: :jake@thedog})))
end
test "run: when a listener for the protocol is active, returns a success", context do

View File

@ -50,7 +50,7 @@ defmodule CheckProtocolListenerCommandTest do
@tag test_timeout: 3000
test "run: targeting an unreachable node throws a badrpc", context do
assert @command.run(["stomp"], Map.merge(context[:opts], %{node: :jake@thedog})) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run(["stomp"], Map.merge(context[:opts], %{node: :jake@thedog})))
end
test "run: when a listener for the protocol is active, returns a success", context do

View File

@ -52,7 +52,7 @@ defmodule CheckRunningCommandTest do
@tag test_timeout: 3000
test "run: targeting an unreachable node throws a badrpc", context do
assert @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})))
end
test "run: when the RabbitMQ app is booted and started, returns true", context do

View File

@ -72,7 +72,7 @@ defmodule CipherSuitesCommandTest do
@tag test_timeout: 3000
test "run: targeting an unreachable node throws a badrpc", context do
assert @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})))
end
test "run: returns a list of cipher suites", context do

View File

@ -47,10 +47,8 @@ defmodule ErlangCookieHashCommandTest do
@tag test_timeout: 3000
test "run: targeting an unreachable node throws a badrpc", context do
target = :jake@thedog
opts = %{node: target}
assert @command.run([], Map.merge(context[:opts], opts)) == {:badrpc, :nodedown}
opts = %{node: :jake@thedog, timeout: 200}
assert match?({:badrpc, _}, @command.run([], Map.merge(context[:opts], opts)))
end
test "run: returns the erlang cookie hash", context do

View File

@ -52,7 +52,7 @@ defmodule ErlangVersionCommandTest do
@tag test_timeout: 3000
test "run: targeting an unreachable node throws a badrpc", context do
assert @command.run([], Map.merge(context[:opts], %{node: :jake@thedog, details: false})) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], Map.merge(context[:opts], %{node: :jake@thedog, details: false})))
end
test "run: returns Erlang/OTP version on the target node", context do

View File

@ -52,7 +52,7 @@ defmodule IsBootingCommandTest do
@tag test_timeout: 3000
test "run: targeting an unreachable node throws a badrpc", context do
assert @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})))
end
test "run: when the RabbitMQ app is fully booted and running, returns false", context do

View File

@ -52,7 +52,7 @@ defmodule IsRunningCommandTest do
@tag test_timeout: 3000
test "run: targeting an unreachable node throws a badrpc", context do
assert @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})))
end
test "run: when the RabbitMQ app is booted and started, returns true", context do

View File

@ -53,7 +53,7 @@ defmodule ListenersCommandTest do
@tag test_timeout: 3000
test "run: targeting an unreachable node throws a badrpc", context do
assert @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})))
end
test "run: returns a list of node-local listeners", context do

View File

@ -48,7 +48,7 @@ defmodule MaybeStuckCommandTest do
@tag test_timeout: 3000
test "run: targeting an unreachable node throws a badrpc", context do
assert @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})))
end
@tag test_timeout: 0

View File

@ -70,10 +70,8 @@ defmodule MemoryBreakdownCommandTest do
end
test "run: request to a non-existent RabbitMQ node returns a nodedown" do
target = :jake@thedog
opts = %{node: target, timeout: 5000, unit: "gb"}
assert match?({:badrpc, :nodedown}, @command.run([], opts))
opts = %{node: :jake@thedog, timeout: 200, unit: "gb"}
assert match?({:badrpc, _}, @command.run([], opts))
end
test "banner", context do

View File

@ -46,7 +46,7 @@ defmodule RuntimeThreadStatsCommandTest do
@tag test_timeout: 2000
test "run: targeting an unreachable node throws a badrpc", context do
assert @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})))
end
@tag test_timeout: 6000

View File

@ -47,7 +47,7 @@ defmodule ServerVersionCommandTest do
@tag test_timeout: 3000
test "run: targeting an unreachable node throws a badrpc", context do
assert @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})))
end
test "run: returns RabbitMQ version on the target node", context do

View File

@ -46,7 +46,7 @@ defmodule TlsVersionsCommandTest do
@tag test_timeout: 3000
test "run: targeting an unreachable node throws a badrpc", context do
assert @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})) == {:badrpc, :nodedown}
assert match?({:badrpc, _}, @command.run([], Map.merge(context[:opts], %{node: :jake@thedog})))
end
test "run when formatter is set to JSON: return a document with a list of supported TLS versions", context do