1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00
samba-mirror/ctdb/tests/UNIT/cunit/config_test_001.sh
Martin Schwenke 51d0445a7d ctdb-logging: Really make NOTICE the default debug level
NOTICE level debug messages in common/run_event.c are not logged by
default.

Currently eventd ends up using ERROR, since this is specified as
LOGGING_LOG_LEVEL_DEFAULT.  It doesn't inherit the debug level from
ctdbd and only uses NOTICE level when interactive.

Change the real logging default to NOTICE and use it everywhere.

Followups might be:

* Remove the default_log_level argument to logging_conf_init()
* Kick eventd to update debug level when "ctdb setdebug" is used

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2023-07-10 14:21:30 +00:00

116 lines
2.3 KiB
Bash
Executable File

#!/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"