diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 17:20:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 17:20:00 +0000 |
commit | 8daa83a594a2e98f39d764422bfbdbc62c9efd44 (patch) | |
tree | 4099e8021376c7d8c05bdf8503093d80e9c7bad0 /ctdb/tests/UNIT/cunit/config_test_001.sh | |
parent | Initial commit. (diff) | |
download | samba-8daa83a594a2e98f39d764422bfbdbc62c9efd44.tar.xz samba-8daa83a594a2e98f39d764422bfbdbc62c9efd44.zip |
Adding upstream version 2:4.20.0+dfsg.upstream/2%4.20.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | ctdb/tests/UNIT/cunit/config_test_001.sh | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/ctdb/tests/UNIT/cunit/config_test_001.sh b/ctdb/tests/UNIT/cunit/config_test_001.sh new file mode 100755 index 0000000..70bf77f --- /dev/null +++ b/ctdb/tests/UNIT/cunit/config_test_001.sh @@ -0,0 +1,115 @@ +#!/bin/sh + +. "${TEST_SCRIPTS_DIR}/unit.sh" + +PATH="$PATH:$CTDB_SCRIPTS_TOOLS_HELPER_DIR" + +setup_ctdb_base "${CTDB_TEST_TMP_DIR}" "ctdb-etc" + +conffile="${CTDB_BASE}/ctdb.conf" + +remove_files () +{ + rm -f "$conffile" +} + +test_cleanup remove_files + +# Get the default values that are dependent on install prefix +logging_location=$(ctdb-config get "logging" "location") +database_volatile_dbdir=$(ctdb-config get \ + "database" \ + "volatile database directory") +database_persistent_dbdir=$(ctdb-config get \ + "database" \ + "persistent database directory") +database_state_dbdir=$(ctdb-config get \ + "database" \ + "state database directory") + +ok <<EOF +[logging] + # location = ${logging_location} + # log level = NOTICE +[cluster] + # transport = tcp + # node address = + # cluster lock = + # recovery lock = + # leader timeout = 5 + # leader capability = true +[database] + # volatile database directory = ${database_volatile_dbdir} + # persistent database directory = ${database_persistent_dbdir} + # state database directory = ${database_state_dbdir} + # lock debug script = + # tdb mutexes = true +[event] + # debug script = +[failover] + # disabled = false +[legacy] + # realtime scheduling = true + # lmaster capability = true + # start as stopped = false + # start as disabled = false + # script log level = ERROR +EOF +unit_test ctdb-config dump + +required_result 2 <<EOF +Failed to load config file $conffile +EOF +unit_test ctdb-config validate + +cat > "$conffile" <<EOF +EOF + +ok_null +unit_test ctdb-config validate + +cat > "$conffile" <<EOF +[foobar] +EOF + +required_result 22 <<EOF +conf: unknown section [foobar] +Failed to load config file $conffile +EOF +unit_test ctdb-config validate + +cat > "$conffile" <<EOF +foobar = cat +EOF + +required_result 22 <<EOF +conf: unknown section for option "foobar" +Failed to load config file $conffile +EOF +unit_test ctdb-config validate + +required_result 2 <<EOF +Configuration option [section] -> "key" not defined +EOF +unit_test ctdb-config get section key + +# Confirm that an unknown key doesn't stop the rest of the file from +# loading +cat > "$conffile" <<EOF +[database] + unknown key = 123 + +[logging] + log level = debug +EOF + +required_error EINVAL <<EOF +conf: unknown option [database] -> "unknown key" +Failed to load config file $conffile +EOF +unit_test ctdb-config validate + +ok <<EOF +debug +EOF +unit_test ctdb-config get "logging" "log level" |