1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 02:21:44 +03:00
Commit Graph

4 Commits

Author SHA1 Message Date
Frantisek Sumsal
5384e84c46 test: wait until the unit leaves the 'inactive' state as well
In many CI runs I noticed a race where we check the "active" state a bit
too early where the unit is still in the "inactive" state, causing the
`is-failed` check to fail. Mitigate this by waiting even if the unit is
in the inactive state and introduce a "safe net" which checks whether
the unit is not restarting indefinitely or more than it should (as
described in the original issue #3166).

Example:
```
[    5.757784] testsuite-11.sh[216]: + systemctl --no-block start fail-on-restart.service
[    5.853657] testsuite-11.sh[222]: ++ systemctl show --value --property ActiveState fail-on-restart.service
[    5.946044] testsuite-11.sh[216]: + active_state=inactive
[    5.946044] testsuite-11.sh[216]: + [[ inactive == \a\c\t\i\v\a\t\i\n\g ]]
[    5.946044] testsuite-11.sh[216]: + [[ inactive == \a\c\t\i\v\e ]]
[    5.946044] testsuite-11.sh[216]: + systemctl is-failed fail-on-restart.service
[    5.946816] systemd[1]: fail-on-restart.service: Passing 0 fds to service
[    5.946913] systemd[1]: fail-on-restart.service: About to execute false
[    5.947011] systemd[1]: fail-on-restart.service: Forked false as 228
[    5.947093] systemd[1]: fail-on-restart.service: Changed dead -> start
[    5.947172] systemd[1]: Starting Fail on restart...
[    5.947272] systemd[228]: fail-on-restart.service: Executing: false
[    5.960553] testsuite-11.sh[227]: activating
[    5.965188] testsuite-11.sh[216]: + exit 1
[    6.011838] systemd[1]: Received SIGCHLD from PID 228 (4).
[    6.012510] systemd[1]: fail-on-restart.service: Main process exited, code=exited, status=1/FAILURE
[    6.012638] systemd[1]: fail-on-restart.service: Failed with result 'exit-code'.
[    6.012834] systemd[1]: fail-on-restart.service: Service will restart (restart setting)
[    6.012963] systemd[1]: fail-on-restart.service: Changed running -> failed
[    6.013081] systemd[1]: fail-on-restart.service: Unit entered failed state.
```
2021-06-18 13:46:29 +09:00
Frantisek Sumsal
84031b5d6e test: bunch of assorted tweaks to make shellcheck happy 2021-04-13 19:14:35 +02:00
Frantisek Sumsal
084575ff91 test: use set -eux and set -o pipefail everywhere
This should make the scripts more robust.
2021-04-13 12:08:01 +02:00
Zbigniew Jędrzejewski-Szmek
3ac189d8aa test: move TEST-11-ISSUE-3166 setup to static files 2020-03-28 11:46:47 +01:00