From c06eca2448045acd44e902cbfb2430ee63dd92fd Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Sun, 26 Jan 2014 13:32:57 +0100 Subject: [PATCH] unittests: fail early when low on disk Scripts from qa that are run as unittests via test/vstart_wrapper.sh may fail because the partition on which it runs is low on space ( 95% full ). When it happens the cause of the problem may be unclear because it is likely to show only as a client not being able to reach the mon. A test is added in test/vstart_wrapper.sh to verify the disk space usage using the same method as the mon would and fail with a detailed error if it is the case. Signed-off-by: Loic Dachary --- src/test/vstart_wrapper.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/test/vstart_wrapper.sh b/src/test/vstart_wrapper.sh index b9e1772d052..42458564c78 100755 --- a/src/test/vstart_wrapper.sh +++ b/src/test/vstart_wrapper.sh @@ -25,20 +25,34 @@ function vstart_setup() mkdir -p dev trap "vstart_teardown ; rm -f $TMPFILE" EXIT export LC_ALL=C # some tests are vulnerable to i18n - MON=1 OSD=3 ./vstart.sh -n -X -l mon osd + MON=1 OSD=3 ./vstart.sh -n -X -l mon osd || return 1 export PATH=.:$PATH export CEPH_CONF=ceph.conf + + crit=$(expr 100 - $(ceph-conf --show-config-value mon_data_avail_crit)) + if [ $(df . | perl -ne 'print if(s/.*\s(\d+)%.*/\1/)') -ge $crit ] ; then + df . + cat <