Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/kola/systemd/data/commonlib.sh
52 changes: 52 additions & 0 deletions tests/kola/systemd/default-unit-timeouts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash
## kola:
## exclusive: false
#
# Checks if default shutdown time is 1m 30s
#
# See: https://github.com/coreos/fedora-coreos-tracker/issues/1404

set -xeuo pipefail

. $KOLA_EXT_DATA/commonlib.sh

DefaultTimeoutStartUSec=$(systemctl show --value --property=DefaultTimeoutStartUSec)
DefaultTimeoutStopUSec=$(systemctl show --value --property=DefaultTimeoutStopUSec)
DefaultTimeoutAbortUSec=$(systemctl show --value --property=DefaultTimeoutAbortUSec)
DefaultDeviceTimeoutUSec=$(systemctl show --value --property=DefaultDeviceTimeoutUSec)

error="DefaultTimeoutStartUsec=$DefaultTimeoutStartUSec DefaultTimeoutStopUSec=$DefaultTimeoutStopUSec DefaultTimeoutAbortUSec=$DefaultTimeoutAbortUSec DefaultDeviceTimeoutUSec=$DefaultDeviceTimeoutUSec"
timeout="1min 30s"

systemd_version=$(rpm -q --queryformat '%{VERSION}' systemd)
required_version="252.4"

# Verify that the timeouts are 1 minute and 30 seconds (90 seconds)

if [[ "$DefaultTimeoutStartUSec" == "$timeout" ]]; then
ok "The default start timeout is 1m 30 seconds."
else
fatal $error
fi

if [[ $DefaultTimeoutStopUSec == "$timeout" ]]; then
ok "The default stop timeout is 1m 30 seconds."
else
fatal $error
fi

if [[ $DefaultTimeoutAbortUSec == "$timeout" ]]; then
ok "The default abort timeout time is 1m 30 seconds."
else
fatal $error
fi

if [[ "${systemd_version}" == "${required_version}" || "${systemd_version}" > "${required_version}" ]]; then
if [[ $DefaultDeviceTimeoutUSec == "$timeout" ]]; then
ok "The default device timeout is 1m 30 seconds."
else
fatal $error
fi
else
ok "This variable is not available in the current systemd version"
fi