]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: Avoiding a fixed 10sec sleep in test_mon_cephdf_commands()
authorErwan Velu <erwan@redhat.com>
Wed, 23 Mar 2016 10:13:48 +0000 (11:13 +0100)
committerErwan Velu <erwan@redhat.com>
Tue, 5 Apr 2016 07:36:25 +0000 (09:36 +0200)
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 <erwan@redhat.com>
qa/workunits/cephtool/test.sh

index bf035ece3ea1c280c31b562c7ad463e9ca8619cb..9140ba061dc1493d2e03216aaa8bd79eb8295a9c 100755 (executable)
@@ -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}'`