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 <erwan@redhat.com>
This commit is contained in:
Erwan Velu 2016-03-23 11:13:48 +01:00
parent 62bdde2cd2
commit c5fa83f586

View File

@ -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}'`