From c5fa83f58658c2efe2b97478e0da502efdf6c8c7 Mon Sep 17 00:00:00 2001 From: Erwan Velu Date: Wed, 23 Mar 2016 11:13:48 +0100 Subject: [PATCH] tests: Avoiding a fixed 10sec sleep in test_mon_cephdf_commands() The current code was waiting 10s to expect the file being put. If the file was put in a shorter time than 10s, the test just waits for nothing reducing the execution speed of that test. This patch simply check if the file is actually available every second during 10sec to exit prematurely. This patch saves exactly 10 sec on a local system, surely a little bit less on an infra but still saves time. Signed-off-by: Erwan Velu --- qa/workunits/cephtool/test.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index bf035ece3ea1c..9140ba061dc14 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -1814,7 +1814,10 @@ function test_mon_cephdf_commands() rados put cephdf_for_test cephdf_for_test -p cephdf_for_test #wait for update - sleep 10 + for i in `seq 1 10`; do + rados -p cephdf_for_test ls - | grep -q cephdf_for_test && break + sleep 1 + done cal_raw_used_size=`ceph df detail | grep cephdf_for_test | awk -F ' ' '{printf "%d\n", 2 * $4}'` raw_used_size=`ceph df detail | grep cephdf_for_test | awk -F ' ' '{print $11}'` -- 2.39.5