mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
ctdb-tests: Conditionally use temporary config file for local daemons
If there's configuration in the environment then daemons_start() should use a temporary configuration file with that appended. This means that global overrides don't (harmlessly) build up in the configuration file during each test and individual tests can override configuration when calling daemons_start() directly. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12180 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
a2bbf71ad6
commit
7885b9652f
@ -123,9 +123,25 @@ daemons_start ()
|
||||
local pidfile="${TEST_VAR_DIR}/ctdbd.${pnn}.pid"
|
||||
local conf="${TEST_VAR_DIR}/ctdbd.${pnn}.conf"
|
||||
|
||||
# If there is any CTDB configuration in the environment then
|
||||
# append it to the regular configuration in a temporary
|
||||
# configuration file and use it just this once.
|
||||
local tmp_conf=""
|
||||
local env_conf=$(config_from_environment)
|
||||
if [ -n "$env_conf" ] ; then
|
||||
tmp_conf=$(mktemp --tmpdir="$TEST_VAR_DIR")
|
||||
cat "$conf" >"$tmp_conf"
|
||||
echo "$env_conf" >>"$tmp_conf"
|
||||
conf="$tmp_conf"
|
||||
fi
|
||||
|
||||
CTDBD="${VALGRIND} ctdbd --sloppy-start --nopublicipcheck" \
|
||||
CTDBD_CONF="$conf" \
|
||||
ctdbd_wrapper "$pidfile" start
|
||||
|
||||
if [ -n "$tmp_conf" ] ; then
|
||||
rm -f "$tmp_conf"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user