diff options
author | Michael Klishin <mklishin@pivotal.io> | 2019-04-12 01:43:54 +0400 |
---|---|---|
committer | Michael Klishin <mklishin@pivotal.io> | 2019-04-12 01:43:54 +0400 |
commit | 001087d945b2988de398cc997f073741731f73d9 (patch) | |
tree | 5d75fe5cc4159afc928cd03d29bbaed73480a3c6 | |
parent | dd022e3be2228c60bf124dfc6871fae057aa8e5f (diff) | |
download | rabbitmq-server-git-001087d945b2988de398cc997f073741731f73d9.tar.gz |
Update :badrpc test cases to be more resilient
On some networks the response is a timeout, not a nodedown. That's
acceptable for this test.
27 files changed, 39 insertions, 59 deletions
diff --git a/deps/rabbitmq_cli/test/ctl/add_user_command_test.exs b/deps/rabbitmq_cli/test/ctl/add_user_command_test.exs index 3d20741cdc..93e4607ba4 100644 --- a/deps/rabbitmq_cli/test/ctl/add_user_command_test.exs +++ b/deps/rabbitmq_cli/test/ctl/add_user_command_test.exs @@ -52,7 +52,7 @@ defmodule AddUserCommandTest do target = :jake@thedog opts = %{node: target} - assert match?({:badrpc, :nodedown}, @command.run([context[:user], context[:password]], opts)) + assert match?({:badrpc, _}, @command.run([context[:user], context[:password]], opts)) end @tag user: "someone", password: "password" diff --git a/deps/rabbitmq_cli/test/ctl/await_startup_command_test.exs b/deps/rabbitmq_cli/test/ctl/await_startup_command_test.exs index b17dc29d99..cff1db7949 100644 --- a/deps/rabbitmq_cli/test/ctl/await_startup_command_test.exs +++ b/deps/rabbitmq_cli/test/ctl/await_startup_command_test.exs @@ -47,7 +47,7 @@ defmodule AwaitStartupCommandTest do target = :jake@thedog opts = %{node: target, timeout: 5} - assert match?({:badrpc, :nodedown}, @command.run([], opts)) + assert match?({:badrpc, _}, @command.run([], opts)) end test "run: request to a fully booted node succeeds", context do diff --git a/deps/rabbitmq_cli/test/ctl/cancel_sync_command_test.exs b/deps/rabbitmq_cli/test/ctl/cancel_sync_command_test.exs index c1e3328315..5565c959b5 100644 --- a/deps/rabbitmq_cli/test/ctl/cancel_sync_command_test.exs +++ b/deps/rabbitmq_cli/test/ctl/cancel_sync_command_test.exs @@ -64,7 +64,7 @@ defmodule CancelSyncQueueCommandTest do target = :jake@thedog opts = %{node: target, vhost: @vhost} - assert match?({:badrpc, :nodedown}, @command.run(["q1"], opts)) + assert match?({:badrpc, _}, @command.run(["q1"], opts)) end test "banner", context do diff --git a/deps/rabbitmq_cli/test/ctl/clear_operator_policy_command_test.exs b/deps/rabbitmq_cli/test/ctl/clear_operator_policy_command_test.exs index 8d05fe8c8b..10692003f2 100644 --- a/deps/rabbitmq_cli/test/ctl/clear_operator_policy_command_test.exs +++ b/deps/rabbitmq_cli/test/ctl/clear_operator_policy_command_test.exs @@ -84,10 +84,7 @@ 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} + assert match?({:badrpc, _}, @command.run([@key], %{node: :jake@thedog, vhost: @vhost, timeout: 200})) end diff --git a/deps/rabbitmq_cli/test/ctl/close_all_connections_command_test.exs b/deps/rabbitmq_cli/test/ctl/close_all_connections_command_test.exs index 52f36c85b5..ce093c21db 100644 --- a/deps/rabbitmq_cli/test/ctl/close_all_connections_command_test.exs +++ b/deps/rabbitmq_cli/test/ctl/close_all_connections_command_test.exs @@ -103,7 +103,7 @@ defmodule CloseAllConnectionsCommandTest 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)) + assert match?({:badrpc, _}, @command.run(["test"], opts)) end test "banner for vhost option", context do diff --git a/deps/rabbitmq_cli/test/ctl/close_connection_command_test.exs b/deps/rabbitmq_cli/test/ctl/close_connection_command_test.exs index 2b2a3fa573..94277b6157 100644 --- a/deps/rabbitmq_cli/test/ctl/close_connection_command_test.exs +++ b/deps/rabbitmq_cli/test/ctl/close_connection_command_test.exs @@ -72,7 +72,7 @@ defmodule CloseConnectionCommandTest do target = :jake@thedog opts = %{node: target} - assert match?({:badrpc, :nodedown}, @command.run(["<rabbit@localhost.1.2.1>", "test"], opts)) + assert match?({:badrpc, _}, @command.run(["<rabbit@localhost.1.2.1>", "test"], opts)) end test "banner", context do diff --git a/deps/rabbitmq_cli/test/ctl/node_health_check_command_test.exs b/deps/rabbitmq_cli/test/ctl/node_health_check_command_test.exs index 52c339e04b..106902d534 100644 --- a/deps/rabbitmq_cli/test/ctl/node_health_check_command_test.exs +++ b/deps/rabbitmq_cli/test/ctl/node_health_check_command_test.exs @@ -67,7 +67,7 @@ defmodule NodeHealthCheckCommandTest do target = :jake@thedog - assert match?({:badrpc, :nodedown}, @command.run([], %{node: target, timeout: 70000})) + assert match?({:badrpc, _}, @command.run([], %{node: target, timeout: 70000})) end test "banner", context do diff --git a/deps/rabbitmq_cli/test/ctl/reset_command_test.exs b/deps/rabbitmq_cli/test/ctl/reset_command_test.exs index ad176a7254..b397625aaf 100644 --- a/deps/rabbitmq_cli/test/ctl/reset_command_test.exs +++ b/deps/rabbitmq_cli/test/ctl/reset_command_test.exs @@ -65,7 +65,7 @@ defmodule ResetCommandTest do target = :jake@thedog opts = %{node: target} - assert match?({:badrpc, :nodedown}, @command.run([], opts)) + assert match?({:badrpc, _}, @command.run([], opts)) end test "banner", context do diff --git a/deps/rabbitmq_cli/test/ctl/rotate_logs_command_test.exs b/deps/rabbitmq_cli/test/ctl/rotate_logs_command_test.exs index 846afd101d..cd3407236f 100644 --- a/deps/rabbitmq_cli/test/ctl/rotate_logs_command_test.exs +++ b/deps/rabbitmq_cli/test/ctl/rotate_logs_command_test.exs @@ -43,7 +43,7 @@ defmodule RotateLogsCommandTest do target = :jake@thedog opts = %{node: target} - assert match?({:badrpc, :nodedown}, @command.run([], opts)) + assert match?({:badrpc, _}, @command.run([], opts)) end test "banner", context do diff --git a/deps/rabbitmq_cli/test/ctl/set_log_level_command_test.exs b/deps/rabbitmq_cli/test/ctl/set_log_level_command_test.exs index 6155420666..650a4ff448 100644 --- a/deps/rabbitmq_cli/test/ctl/set_log_level_command_test.exs +++ b/deps/rabbitmq_cli/test/ctl/set_log_level_command_test.exs @@ -45,7 +45,7 @@ defmodule SetLogLevelCommandTest do 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)) + assert match?({:badrpc, _}, @command.run([context[:log_level]], opts)) end test "banner", context do diff --git a/deps/rabbitmq_cli/test/ctl/start_app_command_test.exs b/deps/rabbitmq_cli/test/ctl/start_app_command_test.exs index cc54b7d7d3..dc6024d5e6 100644 --- a/deps/rabbitmq_cli/test/ctl/start_app_command_test.exs +++ b/deps/rabbitmq_cli/test/ctl/start_app_command_test.exs @@ -55,7 +55,7 @@ defmodule StartAppCommandTest do target = :jake@thedog opts = %{node: target} - assert match?({:badrpc, :nodedown}, @command.run([], opts)) + assert match?({:badrpc, _}, @command.run([], opts)) end test "banner", context do diff --git a/deps/rabbitmq_cli/test/ctl/status_command_test.exs b/deps/rabbitmq_cli/test/ctl/status_command_test.exs index cac3f2aab3..14cbc917b6 100644 --- a/deps/rabbitmq_cli/test/ctl/status_command_test.exs +++ b/deps/rabbitmq_cli/test/ctl/status_command_test.exs @@ -42,7 +42,7 @@ defmodule StatusCommandTest do target = :jake@thedog opts = %{node: target, timeout: 60_000} - assert match?({:badrpc, :nodedown}, @command.run([], opts)) + assert match?({:badrpc, _}, @command.run([], opts)) end test "banner", context do diff --git a/deps/rabbitmq_cli/test/ctl/stop_app_command_test.exs b/deps/rabbitmq_cli/test/ctl/stop_app_command_test.exs index 4c76da89b7..4b9b8571de 100644 --- a/deps/rabbitmq_cli/test/ctl/stop_app_command_test.exs +++ b/deps/rabbitmq_cli/test/ctl/stop_app_command_test.exs @@ -51,7 +51,7 @@ defmodule StopAppCommandTest do target = :jake@thedog opts = %{node: target} - assert match?({:badrpc, :nodedown}, @command.run([], opts)) + assert match?({:badrpc, _}, @command.run([], opts)) end test "banner", context do diff --git a/deps/rabbitmq_cli/test/ctl/stop_command_test.exs b/deps/rabbitmq_cli/test/ctl/stop_command_test.exs index b709125dfe..cc91a09aa8 100644 --- a/deps/rabbitmq_cli/test/ctl/stop_command_test.exs +++ b/deps/rabbitmq_cli/test/ctl/stop_command_test.exs @@ -49,7 +49,7 @@ defmodule StopCommandTest do target = :jake@thedog opts = %{node: target, idempotent: false} - assert match?({:badrpc, :nodedown}, @command.run([], opts)) + assert match?({:badrpc, _}, @command.run([], opts)) end test "run: request to a non-existent node with --idempotent returns ok" do diff --git a/deps/rabbitmq_cli/test/ctl/sync_queue_command_test.exs b/deps/rabbitmq_cli/test/ctl/sync_queue_command_test.exs index 36cdf5a2b1..6e529e94a2 100644 --- a/deps/rabbitmq_cli/test/ctl/sync_queue_command_test.exs +++ b/deps/rabbitmq_cli/test/ctl/sync_queue_command_test.exs @@ -66,7 +66,7 @@ defmodule SyncQueueCommandTest do target = :jake@thedog opts = %{node: target, vhost: @vhost} - assert match?({:badrpc, :nodedown}, @command.run(["q1"], opts)) + assert match?({:badrpc, _}, @command.run(["q1"], opts)) end test "banner", context do diff --git a/deps/rabbitmq_cli/test/ctl/update_cluster_nodes_command_test.exs b/deps/rabbitmq_cli/test/ctl/update_cluster_nodes_command_test.exs index 43a3754817..2bd8119640 100644 --- a/deps/rabbitmq_cli/test/ctl/update_cluster_nodes_command_test.exs +++ b/deps/rabbitmq_cli/test/ctl/update_cluster_nodes_command_test.exs @@ -60,24 +60,12 @@ defmodule UpdateClusterNodesCommandTest do 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. - assert match?( - {:badrpc, :nodedown}, - @command.run([context[:opts][:node]], opts)) + assert match?({:badrpc, _}, @command.run([context[:opts][:node]], %{node: :jake@thedog, timeout: 200})) end test "run: specifying an unreachable node as seed returns nodedown", context do - target = :jake@thedog - stop_rabbitmq_app() - assert match?( - {:badrpc_multi, :nodedown, [_]}, - @command.run([target], context[:opts])) + assert match?({:badrpc_multi, _, [_]}, @command.run([:jake@thedog], context[:opts])) start_rabbitmq_app() end diff --git a/deps/rabbitmq_cli/test/diagnostics/check_port_connectivity_command_test.exs b/deps/rabbitmq_cli/test/diagnostics/check_port_connectivity_command_test.exs index ce818d6c3c..d00e548b27 100644 --- a/deps/rabbitmq_cli/test/diagnostics/check_port_connectivity_command_test.exs +++ b/deps/rabbitmq_cli/test/diagnostics/check_port_connectivity_command_test.exs @@ -45,8 +45,8 @@ defmodule CheckPortConnectivityCommandTest do end @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} + test "run: targeting an unreachable node throws a badrpc" do + assert match?({:badrpc, _}, @command.run([], %{node: :jake@thedog, timeout: 200})) end test "run: tries to connect to every inferred active listener", context do diff --git a/deps/rabbitmq_cli/test/diagnostics/check_port_listener_command_test.exs b/deps/rabbitmq_cli/test/diagnostics/check_port_listener_command_test.exs index eed32c87db..105daa0c6c 100644 --- a/deps/rabbitmq_cli/test/diagnostics/check_port_listener_command_test.exs +++ b/deps/rabbitmq_cli/test/diagnostics/check_port_listener_command_test.exs @@ -49,8 +49,8 @@ defmodule CheckPortListenerCommandTest do end @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} + test "run: targeting an unreachable node throws a badrpc" do + assert match?({:badrpc, _}, @command.run([61613], %{node: :jake@thedog, timeout: 200})) end test "run: when a listener for the protocol is active, returns a success", context do diff --git a/deps/rabbitmq_cli/test/diagnostics/check_protocol_listener_command_test.exs b/deps/rabbitmq_cli/test/diagnostics/check_protocol_listener_command_test.exs index 44834386aa..c98abe1413 100644 --- a/deps/rabbitmq_cli/test/diagnostics/check_protocol_listener_command_test.exs +++ b/deps/rabbitmq_cli/test/diagnostics/check_protocol_listener_command_test.exs @@ -49,8 +49,8 @@ defmodule CheckProtocolListenerCommandTest do end @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} + test "run: targeting an unreachable node throws a badrpc" do + assert match?({:badrpc, _}, @command.run(["stomp"], %{node: :jake@thedog, timeout: 200})) end test "run: when a listener for the protocol is active, returns a success", context do diff --git a/deps/rabbitmq_cli/test/diagnostics/erlang_cookie_hash_command_test.exs b/deps/rabbitmq_cli/test/diagnostics/erlang_cookie_hash_command_test.exs index 160aca3045..cbc1bf5313 100644 --- a/deps/rabbitmq_cli/test/diagnostics/erlang_cookie_hash_command_test.exs +++ b/deps/rabbitmq_cli/test/diagnostics/erlang_cookie_hash_command_test.exs @@ -46,11 +46,8 @@ defmodule ErlangCookieHashCommandTest do end @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} + test "run: targeting an unreachable node throws a badrpc" do + assert match?({:badrpc, _}, @command.run([], %{node: :jake@thedog, timeout: 200})) end test "run: returns the erlang cookie hash", context do diff --git a/deps/rabbitmq_cli/test/diagnostics/erlang_version_command_test.exs b/deps/rabbitmq_cli/test/diagnostics/erlang_version_command_test.exs index f94b6efc90..cf9c834282 100644 --- a/deps/rabbitmq_cli/test/diagnostics/erlang_version_command_test.exs +++ b/deps/rabbitmq_cli/test/diagnostics/erlang_version_command_test.exs @@ -51,8 +51,8 @@ defmodule ErlangVersionCommandTest do end @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} + test "run: targeting an unreachable node throws a badrpc" do + assert match?({:badrpc, _}, @command.run([], %{node: :jake@thedog, details: false, timeout: 200})) end test "run: returns Erlang/OTP version on the target node", context do diff --git a/deps/rabbitmq_cli/test/diagnostics/memory_breakdown_command_test.exs b/deps/rabbitmq_cli/test/diagnostics/memory_breakdown_command_test.exs index a7582ce200..a0f76d499f 100644 --- a/deps/rabbitmq_cli/test/diagnostics/memory_breakdown_command_test.exs +++ b/deps/rabbitmq_cli/test/diagnostics/memory_breakdown_command_test.exs @@ -73,7 +73,7 @@ defmodule MemoryBreakdownCommandTest do target = :jake@thedog opts = %{node: target, timeout: 5000, unit: "gb"} - assert match?({:badrpc, :nodedown}, @command.run([], opts)) + assert match?({:badrpc, _}, @command.run([], opts)) end test "banner", context do diff --git a/deps/rabbitmq_cli/test/queues/add_member_command_test.exs b/deps/rabbitmq_cli/test/queues/add_member_command_test.exs index 6fcc43016b..16eddea42e 100644 --- a/deps/rabbitmq_cli/test/queues/add_member_command_test.exs +++ b/deps/rabbitmq_cli/test/queues/add_member_command_test.exs @@ -51,8 +51,8 @@ defmodule RabbitMQ.CLI.Queues.Commands.AddMemberCommandTest do end @tag test_timeout: 3000 - test "run: targeting an unreachable node throws a badrpc", context do - assert @command.run(["quorum-queue-a", "rabbit@new-node"], - Map.merge(context[:opts], %{node: :jake@thedog, vhost: "/"})) == {:badrpc, :nodedown} + test "run: targeting an unreachable node throws a badrpc" do + assert match?({:badrpc, _}, @command.run(["quorum-queue-a", "rabbit@new-node"], + %{node: :jake@thedog, vhost: "/", timeout: 200})) end end diff --git a/deps/rabbitmq_cli/test/queues/delete_member_command_test.exs b/deps/rabbitmq_cli/test/queues/delete_member_command_test.exs index f15a0a9763..67cb5ba034 100644 --- a/deps/rabbitmq_cli/test/queues/delete_member_command_test.exs +++ b/deps/rabbitmq_cli/test/queues/delete_member_command_test.exs @@ -51,8 +51,8 @@ defmodule RabbitMQ.CLI.Queues.Commands.DeleteMemberCommandTest do end @tag test_timeout: 3000 - test "run: targeting an unreachable node throws a badrpc", context do - assert @command.run(["quorum-queue-a", "rabbit@new-node"], - Map.merge(context[:opts], %{node: :jake@thedog, vhost: "/"})) == {:badrpc, :nodedown} + test "run: targeting an unreachable node throws a badrpc" do + assert match?({:badrpc, _}, @command.run(["quorum-queue-a", "rabbit@new-node"], + %{node: :jake@thedog, vhost: "/", timeout: 200})) end end diff --git a/deps/rabbitmq_cli/test/queues/grow_command_test.exs b/deps/rabbitmq_cli/test/queues/grow_command_test.exs index 1a1f10d502..862068ceb1 100644 --- a/deps/rabbitmq_cli/test/queues/grow_command_test.exs +++ b/deps/rabbitmq_cli/test/queues/grow_command_test.exs @@ -70,8 +70,7 @@ defmodule RabbitMQ.CLI.Queues.Commands.GrowCommandTest do @tag test_timeout: 3000 test "run: targeting an unreachable node throws a badrpc", context do - assert @command.run(["quorum-queue-a", "all"], - Map.merge(context[:opts], %{node: :jake@thedog})) == - {:badrpc, :nodedown} + assert match?({:badrpc, _}, @command.run(["quorum-queue-a", "all"], + Map.merge(context[:opts], %{node: :jake@thedog, timeout: 200}))) end end diff --git a/deps/rabbitmq_cli/test/queues/shrink_command_test.exs b/deps/rabbitmq_cli/test/queues/shrink_command_test.exs index 7050ad4ae7..13071d5782 100644 --- a/deps/rabbitmq_cli/test/queues/shrink_command_test.exs +++ b/deps/rabbitmq_cli/test/queues/shrink_command_test.exs @@ -58,8 +58,7 @@ defmodule RabbitMQ.CLI.Queues.Commands.ShrinkCommandTest do @tag test_timeout: 3000 test "run: targeting an unreachable node throws a badrpc", context do - assert @command.run(["quorum-queue-a"], - Map.merge(context[:opts], %{node: :jake@thedog, vhost: "/"})) == - {:badrpc, :nodedown} + assert match?({:badrpc, _}, @command.run(["quorum-queue-a"], + Map.merge(context[:opts], %{node: :jake@thedog, vhost: "/", timeout: 200}))) end end diff --git a/deps/rabbitmq_cli/test/rabbitmqctl_test.exs b/deps/rabbitmq_cli/test/rabbitmqctl_test.exs index 9c3e6e41d1..34ce3d2c32 100644 --- a/deps/rabbitmq_cli/test/rabbitmqctl_test.exs +++ b/deps/rabbitmq_cli/test/rabbitmqctl_test.exs @@ -92,7 +92,7 @@ defmodule RabbitMQCtlTest do end) =~ ~r/usage/i end - test "Short names without host connect properly" do + test "short node name without the host part connects properly" do command = ["status", "-n", "rabbit"] capture_io(:stderr, fn -> error_check(command, exit_ok()) end) end |