From: Erwan Velu Date: Wed, 23 Mar 2016 10:13:48 +0000 (+0100) Subject: tests: Avoiding a fixed 10sec sleep in test_mon_cephdf_commands() X-Git-Tag: v10.1.1~3^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c5fa83f58658c2efe2b97478e0da502efdf6c8c7;p=ceph.git 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 --- diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index bf035ece3ea1..9140ba061dc1 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}'`