From 9f160e60ad725ca7d3d68141e20c0fea8fa027a2 Mon Sep 17 00:00:00 2001 From: Ryan Zezeski Date: Fri, 24 May 2013 12:42:09 -0400 Subject: [PATCH] Wait for 'cluster plan' to succeed (verify_staged_clustering) While running the `verify_staged_clustering` test on my local workstation I hit a race when force replacing dev3 with dev2. The call to 'cluster plan' was happening before the ring had converged and thus failing, but the test assumed the first call always succeeds. This patch simply mimicks what a user might do and retry the 'cluster plan' command over and over until it succeeds. --- tests/verify_staged_clustering.erl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/verify_staged_clustering.erl b/tests/verify_staged_clustering.erl index fc92a674..0370d043 100644 --- a/tests/verify_staged_clustering.erl +++ b/tests/verify_staged_clustering.erl @@ -137,7 +137,14 @@ stage_force_replace(Node, Node1, Node2) -> print_staged(Node) -> %% rpc:call(Node, riak_core_console, print_staged, [[]]). - rt:admin(Node, ["cluster", "plan"]). + F = fun(_) -> + {ok, StdOut} = rt:admin(Node, ["cluster", "plan"]), + case StdOut of + "Cannot" ++ _X -> false; + _ -> true + end + end, + rt:wait_until(Node, F). commit_staged(Node) -> %% rpc:call(Node, riak_core_console, commit_staged, [[]]).