test: spawn the to-be-killed-on-soft-reboot units with --collect
authorFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 3 Oct 2023 14:40:49 +0000 (16:40 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 3 Oct 2023 14:40:49 +0000 (16:40 +0200)
commit2f397514ad34681d636bf9ff39ea650fc219bd39
tree439be2b078b8d06b70e3e95bfdb33fe21d644b74
parent399a8a5eb1cd311e333e26ba597d2401102a901f
test: spawn the to-be-killed-on-soft-reboot units with --collect

Otherwise they might leave stuff behind if they don't respond fast
enough to the first SIGTERM and get SIGKILLEd, which then breaks reusing
the unit name further in the test:

[ 2993.620849] H testsuite-82.sh[43]: + systemd-run -p Type=exec -p DefaultDependencies=no -p IgnoreOnIsolate=yes --unit=testsuite-82-nosurvive.service sleep infinity
[ 2993.628686] H systemd[1]: testsuite-82-nosurvive.service: About to execute: /usr/bin/sleep infinity
[ 2993.628886] H systemd[1]: testsuite-82-nosurvive.service: Forked /usr/bin/sleep as 65
[ 2993.629328] H systemd[1]: testsuite-82-nosurvive.service: Changed dead -> start
...
[ 2993.699892] H testsuite-82.sh[43]: + systemctl --no-block --check-inhibitors=yes soft-reboot
[ 2993.704326] H systemd-logind[41]: The system will soft-reboot now!
...
[ 3001.249302] H systemd[1]: Sending SIGKILL to PID 65 (sleep).
...
[ 3001.303158] H testsuite-82.sh[136]: + systemd-notify '--status=Second Boot'
...
[ 3001.409504] H testsuite-82.sh[136]: + systemd-run -p Type=exec --unit=testsuite-82-nosurvive.service sleep infinity
[ 3001.414061] H testsuite-82.sh[165]: Failed to start transient service unit: Unit testsuite-82-nosurvive.service was already loaded or has a fragment file.

Spotted in Ubuntu CI.
test/units/testsuite-82.sh