1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

ctdb-tests: Use setup_ctdb_base() for simple tests

The comment in local.bash is incorrect.  CTDB_BASE will never be set
here because this script is not run under onnode.  Instead, this where
CTDB_BASE needs to be set when running against a real cluster.

For local daemons, the check for CTDB_BASE being inconsistent with
node_dir is temporary.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2018-02-07 18:38:04 +11:00 committed by Martin Schwenke
parent caf6b1c684
commit a7a5216968
4 changed files with 25 additions and 21 deletions

View File

@ -1 +0,0 @@
../../config/functions

View File

@ -6,11 +6,11 @@ export SIMPLE_TESTS_VAR_DIR="${TEST_VAR_DIR}/simple"
# Don't remove old directory since state is retained between tests
mkdir -p "$SIMPLE_TESTS_VAR_DIR"
# onnode needs CTDB_BASE to be set when run in-tree
if [ -z "$CTDB_BASE" ] ; then
export CTDB_BASE="$TEST_SUBDIR"
fi
if [ -n "$TEST_LOCAL_DAEMONS" ] ; then
. "${TEST_SUBDIR}/scripts/local_daemons.bash"
if [ -z "$TEST_LOCAL_DAEMONS" ] ; then
# Running against a real cluster
setup_ctdb_base "$SIMPLE_TESTS_VAR_DIR" "ctdb-etc" \
functions \
nodes
else
. "${TEST_SUBDIR}/scripts/local_daemons.bash"
fi

View File

@ -159,7 +159,13 @@ setup_ctdb ()
local pnn
for pnn in $(seq 0 $(($TEST_LOCAL_DAEMONS - 1))) ; do
local node_dir=$(node_dir "$pnn")
mkdir -p "$node_dir"
setup_ctdb_base "$SIMPLE_TESTS_VAR_DIR" "node.${pnn}" \
functions
if [ "$node_dir" != "$CTDB_BASE" ] ; then
die "Inconsistent CTDB_BASE"
fi
local public_addresses="${node_dir}/public_addresses"
@ -202,6 +208,7 @@ EOF
start_ctdb_1 ()
{
local pnn="$1"
local node_dir=$(node_dir "$pnn")
local pidfile=$(node_pidfile "$pnn")
local conf=$(node_conf "$pnn")
@ -218,6 +225,7 @@ start_ctdb_1 ()
fi
CTDBD="${VALGRIND} ctdbd --sloppy-start --nopublicipcheck" \
CTDB_BASE="$node_dir" \
CTDBD_CONF="$conf" \
CTDB_PIDFILE="$pidfile" \
ctdbd_wrapper start
@ -240,12 +248,14 @@ daemons_start ()
stop_ctdb_1 ()
{
local pnn="$1"
local node_dir=$(node_dir "$pnn")
local pidfile=$(node_pidfile "$pnn")
local conf=$(node_conf "$pnn")
CTDBD_CONF="$conf" \
CTDB_PIDFILE="$pidfile" \
ctdbd_wrapper stop
CTDB_BASE="$node_dir" \
CTDBD_CONF="$conf" \
CTDB_PIDFILE="$pidfile" \
ctdbd_wrapper stop
}
daemons_stop ()
@ -298,3 +308,7 @@ for i in $(seq 0 $(($TEST_LOCAL_DAEMONS - 1))) ; do
socket=$(node_socket "$i")
CTDB_NODES_SOCKETS="${CTDB_NODES_SOCKETS}${CTDB_NODES_SOCKETS:+ }${socket}"
done
# Need a default CTDB_BASE for onnode (to find the functions file).
# Any node will do, so pick the 1st...
export CTDB_BASE=$(node_dir 0)

View File

@ -944,15 +944,6 @@ def build(bld):
bld.symlink_as(os.path.join(bld.env.BINDIR, 'ctdb_run_cluster_tests'),
'ctdb_run_tests')
# Tests that use onnode need to overwrite link to in-tree
# functions file when installed
bld.symlink_as(os.path.join(bld.env.CTDB_TEST_DATADIR, 'simple/functions'),
os.path.join(bld.env.CTDB_ETCDIR, 'functions'))
# Need a link to nodes file because $CTDB_BASE is overridden
bld.symlink_as(os.path.join(bld.env.CTDB_TEST_DATADIR, 'simple/nodes'),
os.path.join(bld.env.CTDB_ETCDIR, 'nodes'))
def testonly(ctx):
cmd = 'tests/run_tests.sh -V tests/var'