1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
summary: Check that UC debug settings work
details: |
Check that UC debug settings enable logging for snapd and
setting the log level for systemd as expected.
# Some systemctl calls are not supported on UC16
systems: [-ubuntu-core-16-*]
execute: |
get_log_level() {
if os.query is-core-le 18; then
systemd-analyze get-log-level
else
systemctl log-level
fi
}
if [ "$SPREAD_REBOOT" = 0 ]; then
# Remove the variable introduced by prepare.sh
sed -i 's/SNAPD_DEBUG=1//' /etc/systemd/system/snapd.service.d/local.conf
systemctl daemon-reload
systemctl restart snapd
NOMATCH SNAPD_DEBUG=1 < /proc/"$(pgrep snapd)"/environ
# Check enable/disable snapd debug traces
snap set system debug.snapd.log=true
MATCH SNAPD_DEBUG=1 < /var/lib/snapd/environment/snapd.conf
systemctl restart snapd
MATCH SNAPD_DEBUG=1 < /proc/"$(pgrep snapd)"/environ
snap set system debug.snapd.log=false
not test -f /var/lib/snapd/environment/snapd.conf
systemctl restart snapd
NOMATCH SNAPD_DEBUG=1 < /proc/"$(pgrep snapd)"/environ
# Check set systemd log level
log_level=$(get_log_level)
test "$log_level" = info
snap set system debug.systemd.log-level=debug
MATCH LogLevel=debug < /etc/systemd/system.conf.d/20-debug_systemd_log-level.conf
log_level=$(get_log_level)
test "$log_level" = debug
# Reboot to check log-level is as expected when systemd restarts
REBOOT
else
log_level=$(get_log_level)
test "$log_level" = debug
snap set system debug.systemd.log-level=info
MATCH LogLevel=info < /etc/systemd/system.conf.d/20-debug_systemd_log-level.conf
log_level=$(get_log_level)
test "$log_level" = info
fi
|