diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2019-07-31 14:33:13 +0200 |
|---|---|---|
| committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2019-09-16 11:20:01 +0200 |
| commit | 97bdf00f8e542fd2dabd3cd58764bb5f3a9de662 (patch) | |
| tree | 1041cc076111257e8738af30dfe687ff436d080d /test | |
| parent | 1ea159047ee2250c251c8d9a7c7868692fce48c9 (diff) | |
| download | rabbitmq-server-git-97bdf00f8e542fd2dabd3cd58764bb5f3a9de662.tar.gz | |
clustering_management_SUITE: Just wait for PID file content to change
Don't try to check if the referenced process is alive or not. It could
be gone already and that's the job of rabbitmqtl(8): this testcase kind
of reimplemented the wait command.
Diffstat (limited to 'test')
| -rw-r--r-- | test/clustering_management_SUITE.erl | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/test/clustering_management_SUITE.erl b/test/clustering_management_SUITE.erl index f067383e6f..7441ef345b 100644 --- a/test/clustering_management_SUITE.erl +++ b/test/clustering_management_SUITE.erl @@ -106,7 +106,8 @@ init_per_testcase(Testcase, Config) -> TestNumber = rabbit_ct_helpers:testcase_number(Config, ?MODULE, Testcase), Config1 = rabbit_ct_helpers:set_config(Config, [ {rmq_nodename_suffix, Testcase}, - {tcp_ports_base, {skip_n_nodes, TestNumber * ClusterSize}} + {tcp_ports_base, {skip_n_nodes, TestNumber * ClusterSize}}, + {keep_pid_file_on_exit, true} ]), rabbit_ct_helpers:run_steps(Config1, rabbit_ct_broker_helpers:setup_steps() ++ @@ -700,13 +701,14 @@ pid_file_and_await_node_startup(Config) -> ok = rabbit_ct_broker_helpers:stop_node(Config, Hare), %% starting first node fails - it was not the last node to stop {error, _} = rabbit_ct_broker_helpers:start_node(Config, Rabbit), + PreviousPid = pid_from_file(RabbitPidFile), %% start first node in the background spawn_link(fun() -> rabbit_ct_broker_helpers:start_node(Config, Rabbit) end), Attempts = 200, Timeout = 50, - wait_for_pid_file_to_contain_running_process_pid(RabbitPidFile, Attempts, Timeout), + wait_for_pid_file_to_change(RabbitPidFile, PreviousPid, Attempts, Timeout), {error, _, _} = rabbit_ct_broker_helpers:rabbitmqctl(Config, Rabbit, ["wait", RabbitPidFile]). @@ -754,15 +756,18 @@ await_running_count(Config) -> %% Internal utils %% ---------------------------------------------------------------------------- -wait_for_pid_file_to_contain_running_process_pid(_, 0, _) -> +wait_for_pid_file_to_change(_, 0, _, _) -> error(timeout_waiting_for_pid_file_to_have_running_pid); -wait_for_pid_file_to_contain_running_process_pid(PidFile, Attempts, Timeout) -> +wait_for_pid_file_to_change(PidFile, PreviousPid, Attempts, Timeout) -> Pid = pid_from_file(PidFile), - case Pid =/= undefined andalso rabbit_misc:is_os_process_alive(Pid) of + case Pid =/= undefined andalso Pid =/= PreviousPid of true -> ok; false -> ct:sleep(Timeout), - wait_for_pid_file_to_contain_running_process_pid(PidFile, Attempts - 1, Timeout) + wait_for_pid_file_to_change(PidFile, + PreviousPid, + Attempts - 1, + Timeout) end. pid_from_file(PidFile) -> |
