Compare commits

..

No commits in common. "d2fc7d22cbe4f72c5993cd02b414aad60674c7f7" and "02baf239d87295362740d961765091b778795573" have entirely different histories.

2 changed files with 9 additions and 21 deletions

View File

@ -0,0 +1,4 @@
This appears to be failing on Ubuntu CI due to short sleep duration
waiting for the service-restarts to complete, but doubling the
sleep from 5 to 10 seconds didn't appear to help, so let's blacklist
this on Ubuntu CI while debugging the test failure.

View File

@ -2,19 +2,14 @@
set -ex set -ex
set -o pipefail set -o pipefail
# wait this many secs for each test service to succeed in what is being tested
MAX_SECS=60
systemd-analyze log-level debug systemd-analyze log-level debug
systemd-analyze log-target console systemd-analyze log-target console
# test one: Restart=on-failure should restart the service # These three commands should succeed.
! systemd-run --unit=one -p Type=oneshot -p Restart=on-failure /bin/bash -c "exit 1" ! systemd-run --unit=one -p Type=oneshot -p Restart=on-failure /bin/bash -c "exit 1"
for ((secs=0; secs<$MAX_SECS; secs++)); do sleep 5
[[ "$(systemctl show one.service -p NRestarts --value)" -le 0 ]] || break
sleep 1
done
if [[ "$(systemctl show one.service -p NRestarts --value)" -le 0 ]]; then if [[ "$(systemctl show one.service -p NRestarts --value)" -le 0 ]]; then
exit 1 exit 1
fi fi
@ -23,21 +18,10 @@ TMP_FILE="/test-41-oneshot-restart-test"
touch $TMP_FILE touch $TMP_FILE
# test two: make sure StartLimitBurst correctly limits the number of restarts ! systemd-run --unit=two -p StartLimitBurst=3 -p Type=oneshot -p Restart=on-failure -p ExecStart="/bin/bash -c \"printf a >> $TMP_FILE\"" /bin/bash -c "exit 1"
# and restarts execution of the unit from the first ExecStart=
! systemd-run --unit=two -p StartLimitIntervalSec=120 -p StartLimitBurst=3 -p Type=oneshot -p Restart=on-failure -p ExecStart="/bin/bash -c \"printf a >> $TMP_FILE\"" /bin/bash -c "exit 1"
# wait for at least 3 restarts
for ((secs=0; secs<$MAX_SECS; secs++)); do
[[ $(cat $TMP_FILE) != "aaa" ]] || break
sleep 1
done
if [[ $(cat $TMP_FILE) != "aaa" ]]; then
exit 1
fi
# wait for 5 more seconds to make sure there aren't excess restarts
sleep 5 sleep 5
if [[ $(cat $TMP_FILE) != "aaa" ]]; then if [[ $(cat $TMP_FILE) != "aaa" ]]; then
exit 1 exit 1
fi fi