diff options
author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2019-07-30 17:37:30 +0200 |
---|---|---|
committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2019-09-16 11:20:01 +0200 |
commit | 1ea159047ee2250c251c8d9a7c7868692fce48c9 (patch) | |
tree | ae21105e584c4a346f69771a5f40e20142a08cb7 /test/clustering_management_SUITE.erl | |
parent | 0f66eadeb6632c704fa2d5a9082c6dca6819e549 (diff) | |
download | rabbitmq-server-git-1ea159047ee2250c251c8d9a7c7868692fce48c9.tar.gz |
clustering_management_SUITE: Account for the fact that the PID file is removed
... when a node is stopped.
Therefore, watch more frequently that PID file to increase the chance of
seeing it.
Diffstat (limited to 'test/clustering_management_SUITE.erl')
-rw-r--r-- | test/clustering_management_SUITE.erl | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/test/clustering_management_SUITE.erl b/test/clustering_management_SUITE.erl index 0234cc6d2f..f067383e6f 100644 --- a/test/clustering_management_SUITE.erl +++ b/test/clustering_management_SUITE.erl @@ -704,8 +704,8 @@ pid_file_and_await_node_startup(Config) -> spawn_link(fun() -> rabbit_ct_broker_helpers:start_node(Config, Rabbit) end), - Attempts = 10, - Timeout = 500, + Attempts = 200, + Timeout = 50, wait_for_pid_file_to_contain_running_process_pid(RabbitPidFile, Attempts, Timeout), {error, _, _} = rabbit_ct_broker_helpers:rabbitmqctl(Config, Rabbit, ["wait", RabbitPidFile]). @@ -758,7 +758,7 @@ wait_for_pid_file_to_contain_running_process_pid(_, 0, _) -> error(timeout_waiting_for_pid_file_to_have_running_pid); wait_for_pid_file_to_contain_running_process_pid(PidFile, Attempts, Timeout) -> Pid = pid_from_file(PidFile), - case rabbit_misc:is_os_process_alive(Pid) of + case Pid =/= undefined andalso rabbit_misc:is_os_process_alive(Pid) of true -> ok; false -> ct:sleep(Timeout), @@ -766,8 +766,12 @@ wait_for_pid_file_to_contain_running_process_pid(PidFile, Attempts, Timeout) -> end. pid_from_file(PidFile) -> - {ok, Content} = file:read_file(PidFile), - string:strip(binary_to_list(Content), both, $\n). + case file:read_file(PidFile) of + {ok, Content} -> + string:strip(binary_to_list(Content), both, $\n); + {error, enoent} -> + undefined + end. cluster_members(Config) -> rabbit_ct_broker_helpers:get_node_configs(Config, nodename). |