Error out if too many sheep are in the cluster, reduce the wait time, and improve the grammar in the comment explaining it.
Signed-off-by: Christoph Hellwig <[email protected]> --- tests/common.rc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/common.rc b/tests/common.rc index 8c33e4f..b1546b2 100644 --- a/tests/common.rc +++ b/tests/common.rc @@ -143,12 +143,17 @@ _wait_for_collie() done } -# wait all sheep to join completely +# wait for all sheep to join completely _wait_for_sheep() { while true; do - sleep 2 - if [ $($COLLIE node list | wc -l) -eq $(($1+1)) ]; then + sleep 1 + nr_sheep="$($COLLIE node list | wc -l)" + if [ ${nr_sheep} -eq $(($1+1)) ]; then + break + fi + if [ ${nr_sheep} -gt $(($1+1)) ]; then + echo "ERROR: too many sheep in cluster: ${nr_sheep}" break fi done -- 1.7.10.4 -- sheepdog mailing list [email protected] http://lists.wpkg.org/mailman/listinfo/sheepdog
