From 8ea7fa57f4a82d7ebd6f8aa77fd8073b0196cb6e Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Mon, 30 Apr 2018 20:44:36 +1000 Subject: [PATCH] ctdb-tests: CTDB_DBDIR_PERSISTENT should not depend on CTDB_DBDIR Add new variable CTDB_DBDIR_BASE, just for event script unit tests. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/tests/eventscripts/05.system.monitor.001.sh | 2 +- ctdb/tests/eventscripts/scripts/local.sh | 8 +++++--- ctdb/tests/eventscripts/stubs/df | 9 +++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ctdb/tests/eventscripts/05.system.monitor.001.sh b/ctdb/tests/eventscripts/05.system.monitor.001.sh index 35b211f21bd..4171f3deb4d 100755 --- a/ctdb/tests/eventscripts/05.system.monitor.001.sh +++ b/ctdb/tests/eventscripts/05.system.monitor.001.sh @@ -8,6 +8,6 @@ setup set_fs_usage 100 ok <= threshold 90% +WARNING: Filesystem ${CTDB_DBDIR_BASE} utilization 100% >= threshold 90% EOF simple_test diff --git a/ctdb/tests/eventscripts/scripts/local.sh b/ctdb/tests/eventscripts/scripts/local.sh index df5d3d8f624..a90adeca479 100644 --- a/ctdb/tests/eventscripts/scripts/local.sh +++ b/ctdb/tests/eventscripts/scripts/local.sh @@ -85,9 +85,11 @@ setup_script_options () setup_dbdir () { - export CTDB_DBDIR="${EVENTSCRIPTS_TESTS_VAR_DIR}/db" - export CTDB_DBDIR_PERSISTENT="${CTDB_DBDIR}/persistent" - export CTDB_DBDIR_STATE="${CTDB_DBDIR}/state" + export CTDB_DBDIR_BASE="${EVENTSCRIPTS_TESTS_VAR_DIR}/db" + export CTDB_DBDIR="$CTDB_DBDIR_BASE" + export CTDB_DBDIR_PERSISTENT="${CTDB_DBDIR_BASE}/persistent" + export CTDB_DBDIR_STATE="${CTDB_DBDIR_BASE}/state" + mkdir -p "$CTDB_DBDIR" mkdir -p "$CTDB_DBDIR_PERSISTENT" mkdir -p "$CTDB_DBDIR_STATE" } diff --git a/ctdb/tests/eventscripts/stubs/df b/ctdb/tests/eventscripts/stubs/df index 64eb3814cfe..a2e7093293d 100755 --- a/ctdb/tests/eventscripts/stubs/df +++ b/ctdb/tests/eventscripts/stubs/df @@ -16,10 +16,11 @@ esac fs="${1:-/}" -# Anything starting with CTDB_DBDIR gets canonicalised to CTDB_DBDIR. -# This helps with the setting of defaults for the filesystem checks. -if [ "${fs#${CTDB_DBDIR}}" != "$fs" ] ; then - fs="$CTDB_DBDIR" +# Anything starting with CTDB_DBDIR_BASE gets canonicalised to +# CTDB_DBDIR_BASE. This helps with the setting of defaults for the +# filesystem checks. +if [ "${fs#${CTDB_DBDIR_BASE}}" != "$fs" ] ; then + fs="$CTDB_DBDIR_BASE" fi # A default, for tests that don't initialise this...