diff options
| -rw-r--r-- | src/rabbit_connection_tracking.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_connection_tracking_handler.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_peer_discovery.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_peer_discovery_classic_config.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_peer_discovery_dns.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_policy_merge_strategy.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_vhost_limit.erl | 2 | ||||
| -rw-r--r-- | test/backing_queue_SUITE.erl | 91 | ||||
| -rw-r--r-- | test/rabbitmqctl_shutdown_SUITE.erl | 28 |
9 files changed, 29 insertions, 104 deletions
diff --git a/src/rabbit_connection_tracking.erl b/src/rabbit_connection_tracking.erl index 40f1d1f71d..f8c4c6541b 100644 --- a/src/rabbit_connection_tracking.erl +++ b/src/rabbit_connection_tracking.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2016 Pivotal Software, Inc. All rights reserved. +%% Copyright (c) 2007-2017 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_connection_tracking). diff --git a/src/rabbit_connection_tracking_handler.erl b/src/rabbit_connection_tracking_handler.erl index 739b8049c0..f1b844c60c 100644 --- a/src/rabbit_connection_tracking_handler.erl +++ b/src/rabbit_connection_tracking_handler.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2016 Pivotal Software, Inc. All rights reserved. +%% Copyright (c) 2007-2017 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_connection_tracking_handler). diff --git a/src/rabbit_peer_discovery.erl b/src/rabbit_peer_discovery.erl index 2b6701210a..98d2f9e7c5 100644 --- a/src/rabbit_peer_discovery.erl +++ b/src/rabbit_peer_discovery.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is Pivotal Software, Inc. -%% Copyright (c) 2007-2016 Pivotal Software, Inc. All rights reserved. +%% Copyright (c) 2007-2017 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_peer_discovery). diff --git a/src/rabbit_peer_discovery_classic_config.erl b/src/rabbit_peer_discovery_classic_config.erl index d27997240a..685e4b1639 100644 --- a/src/rabbit_peer_discovery_classic_config.erl +++ b/src/rabbit_peer_discovery_classic_config.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2016 Pivotal Software, Inc. All rights reserved. +%% Copyright (c) 2007-2017 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_peer_discovery_classic_config). diff --git a/src/rabbit_peer_discovery_dns.erl b/src/rabbit_peer_discovery_dns.erl index 6082f823b6..5bc85d340d 100644 --- a/src/rabbit_peer_discovery_dns.erl +++ b/src/rabbit_peer_discovery_dns.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2016 Pivotal Software, Inc. All rights reserved. +%% Copyright (c) 2007-2017 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_peer_discovery_dns). diff --git a/src/rabbit_policy_merge_strategy.erl b/src/rabbit_policy_merge_strategy.erl index 55ad87ccac..3c6c6f07ee 100644 --- a/src/rabbit_policy_merge_strategy.erl +++ b/src/rabbit_policy_merge_strategy.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2016 Pivotal Software, Inc. All rights reserved. +%% Copyright (c) 2007-2017 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_policy_merge_strategy). diff --git a/src/rabbit_vhost_limit.erl b/src/rabbit_vhost_limit.erl index d0c775f0bd..58c0ce065f 100644 --- a/src/rabbit_vhost_limit.erl +++ b/src/rabbit_vhost_limit.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2016 Pivotal Software, Inc. All rights reserved. +%% Copyright (c) 2007-2017 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_vhost_limit). diff --git a/test/backing_queue_SUITE.erl b/test/backing_queue_SUITE.erl index 6f760e9914..e17b2afbf3 100644 --- a/test/backing_queue_SUITE.erl +++ b/test/backing_queue_SUITE.erl @@ -1587,94 +1587,3 @@ check_variable_queue_status(VQ0, Props) -> S = variable_queue_status(VQ1), assert_props(S, Props), VQ1. - -%% --------------------------------------------------------------------------- -%% rabbitmqctl helpers. -%% --------------------------------------------------------------------------- - -control_action(Command, Args) -> - control_action(Command, node(), Args, default_options()). - -control_action(Command, Args, NewOpts) -> - control_action(Command, node(), Args, - expand_options(default_options(), NewOpts)). - -control_action(Command, Node, Args, Opts) -> - case catch rabbit_control_main:action( - Command, Node, Args, Opts, - fun (Format, Args1) -> - io:format(Format ++ " ...~n", Args1) - end) of - ok -> - io:format("done.~n"), - ok; - {ok, Result} -> - rabbit_control_misc:print_cmd_result(Command, Result), - ok; - Other -> - io:format("failed: ~p~n", [Other]), - Other - end. - -control_action_t(Command, Args, Timeout) when is_number(Timeout) -> - control_action_t(Command, node(), Args, default_options(), Timeout). - -control_action_t(Command, Args, NewOpts, Timeout) when is_number(Timeout) -> - control_action_t(Command, node(), Args, - expand_options(default_options(), NewOpts), - Timeout). - -control_action_t(Command, Node, Args, Opts, Timeout) when is_number(Timeout) -> - case catch rabbit_control_main:action( - Command, Node, Args, Opts, - fun (Format, Args1) -> - io:format(Format ++ " ...~n", Args1) - end, Timeout) of - ok -> - io:format("done.~n"), - ok; - {ok, Result} -> - rabbit_control_misc:print_cmd_result(Command, Result), - ok; - Other -> - io:format("failed: ~p~n", [Other]), - Other - end. - -control_action_opts(Raw) -> - NodeStr = atom_to_list(node()), - case rabbit_control_main:parse_arguments(Raw, NodeStr) of - {ok, {Cmd, Opts, Args}} -> - case control_action(Cmd, node(), Args, Opts) of - ok -> ok; - Error -> Error - end; - Error -> - Error - end. - -info_action(Command, Args, CheckVHost) -> - ok = control_action(Command, []), - if CheckVHost -> ok = control_action(Command, [], ["-p", "/"]); - true -> ok - end, - ok = control_action(Command, lists:map(fun atom_to_list/1, Args)), - {bad_argument, dummy} = control_action(Command, ["dummy"]), - ok. - -info_action_t(Command, Args, CheckVHost, Timeout) when is_number(Timeout) -> - if CheckVHost -> ok = control_action_t(Command, [], ["-p", "/"], Timeout); - true -> ok - end, - ok = control_action_t(Command, lists:map(fun atom_to_list/1, Args), Timeout), - ok. - -default_options() -> [{"-p", "/"}, {"-q", "false"}]. - -expand_options(As, Bs) -> - lists:foldl(fun({K, _}=A, R) -> - case proplists:is_defined(K, R) of - true -> R; - false -> [A | R] - end - end, Bs, As). diff --git a/test/rabbitmqctl_shutdown_SUITE.erl b/test/rabbitmqctl_shutdown_SUITE.erl index f8fd22f746..fa04dc6504 100644 --- a/test/rabbitmqctl_shutdown_SUITE.erl +++ b/test/rabbitmqctl_shutdown_SUITE.erl @@ -87,27 +87,26 @@ save_node(Config) -> successful_shutdown(Config) -> Node = ?config(node, Config), Pid = node_pid(Node), - ok = rabbit_control_main:action(shutdown, Node, [], [], fun ct:pal/2), + ok = shutdown_ok(Node), false = erlang_pid_is_running(Pid), false = node_is_running(Node). error_during_shutdown(Config) -> Node = ?config(node, Config), - ok = rabbit_control_main:action(stop_app, Node, [], [], fun ct:pal/2), + ok = rabbit_ct_broker_helpers:control_action(stop_app, Node, []), ok = rpc:call(Node, application, unload, [os_mon]), {badrpc, {'EXIT', { {error, {badmatch, {error,{edge,{bad_vertex,os_mon},os_mon,rabbit}}}}, - _}}} = - rabbit_control_main:action(shutdown, Node, [], [], fun ct:pal/2). + _}}} = shutdown_error(Node). nothing_to_shutdown(Config) -> Node = ?config(node, Config), - { badrpc, nodedown } = - rabbit_control_main:action(shutdown, Node, [], [], fun ct:pal/2). + { error, 69, _ } = + rabbit_ct_broker_helpers:control_action(shutdown, Node, []). node_pid(Node) -> Val = rpc:call(Node, os, getpid, []), @@ -119,3 +118,20 @@ erlang_pid_is_running(Pid) -> node_is_running(Node) -> net_adm:ping(Node) == pong. + +shutdown_error(Node) -> + %% Start a command + {stream, Stream} = rabbit_ct_broker_helpers:control_action(shutdown, Node, []), + %% Execute command steps. The last one should be error + Lines = 'Elixir.Enum':to_list(Stream), + {error, Err} = lists:last(Lines), + Err. + +shutdown_ok(Node) -> + %% Start a command + {stream, Stream} = rabbit_ct_broker_helpers:control_action(shutdown, Node, []), + %% Execute command steps. Each step will ouput a binary string + Lines = 'Elixir.Enum':to_list(Stream), + ct:pal("Command output ~p ~n", [Lines]), + [true = is_binary(Line) || Line <- Lines], + ok. |
