Commit graph

13 commits

Author SHA1 Message Date
Daan De Meyer e690a8cd09 TEST-69-SHUTDOWN: Order after systemd-user-sessions.service
Make sure that we're allowed to login by ordering ourselves after
systemd-user-sessions.service.
2024-05-31 17:26:13 +02:00
Daan De Meyer e182c7b4db test: Enable TEST-69-SHUTDOWN for mkosi
In mkosi, we run the test inside the VM instead of outside. To simplify
the implementation we drop the reboot part and only verify that we can
schedule and cancel shutdowns and that the wall messages are sent as
expected.
2024-05-16 18:21:32 +02:00
Daan De Meyer 348f5017a4 test: Generate basic testsuite services with meson
Most of these are identical, let's just generate from a meson
template.
2024-05-14 12:43:28 +02:00
Daan De Meyer 4ce12c3933 test: Disable tests via 'enabled' field
This allows doing other stuff with the test without actually defining
the test, such as generating a service unit automatically.
2024-05-14 12:43:28 +02:00
Frantisek Sumsal 8d9cdb31f7 test: make the output of TEST-69 less painful to read
The logs from TEST-69 still contain a lot of unnecessary shell
metacharacters, so to make the output more readable let's just set
TERM=dumb, instead of having to strip everything semi-manually. Also,
move the related --background= tweak to TEST-69, since it's relevant
only for that particular test.

Follow-up for 8d4bfd38ed.
2024-04-11 11:35:17 +02:00
Frantisek Sumsal 7a63c5e550 test: explicitly set TERM=linux for TEST-69-SHUTDOWN
sulogin from the latest util-linux started falling back to vt102 instead
of linux, which makes screen sad (because we install only the linux
terminfo into the test image) and expect trips over the unexpected
warning. Let's just explicitly set TERM=linux before invoking screen to
avoid this.

+ make -C TEST-69-SHUTDOWN setup run
...
INFO:test-shutdown:log in and start screen
root
root
Last login: Sun Mar  3 13:19:31 from 18.191.105.60
-bash-5.2# screen
screen
Cannot find terminfo entry for 'vt102'.
-bash-5.2# ERROR:test-shutdown:Timeout exceeded.
2024-03-03 21:12:43 +01:00
Frantisek Sumsal 270b20b98b test: shorten service stop/abort timeouts for TEST-69-SHUTDOWN
In several Ubuntu CI jobs I noticed timeouts in TEST-69, which are
apparently caused by a very stubborn bash/login process:

$ journalctl -o short-monotonic --no-hostname --file artifacts/TEST-69-SHUTDOWN.journal
[ 2011.698430] systemd[1]: shutdown.target: starting held back, waiting for: veritysetup.target
[ 2011.698473] systemd[1]: sysinit.target: stopping held back, waiting for: user@0.service
[ 2045.884982] systemd[1]: systemd-oomd.service: Got notification message from PID 54 (WATCHDOG=1)
[ 2071.576424] systemd[1]: Received SIGCHLD from PID 65 (bash).
[ 2071.576941] systemd[1]: Child 65 (bash) died (code=killed, status=1/HUP)
[ 2071.577026] systemd[1]: session-13.scope: Child 65 belongs to session-13.scope.
[ 2071.577100] systemd[1]: session-13.scope: cgroup is empty
[ 2071.577249] systemd[1]: session-13.scope: Deactivated successfully.

$ journalctl -o short-monotonic --no-hostname --file artifacts/TEST-69-SHUTDOWN.journal _PID=65
[ 3038.661488] login[65]: ROOT LOGIN  on '/dev/pts/0'

Since, in this case, we really care only about the actual shutdown,
let's shorten the service stop/abort timeouts to let systemd SIGKILL all
remaining processes in the 60s `expect` window.
2023-10-24 12:51:03 +02:00
Frantisek Sumsal 5ab2f737cd test: introduce $TEST_SKIP_SHUTDOWN
To get rid of some boilerplate.
2023-10-24 12:35:03 +02:00
Frantisek Sumsal 1b87ca4fe9 test: use a dropin to override the end.service unit
instead of removing it.
2022-03-21 16:41:49 +01:00
Frantisek Sumsal 3fe2885cc5 test: run test-shutdown.py in verbose mode
To make the debugging of spurious fails a bit easier.
2022-03-21 16:13:09 +01:00
Frantisek Sumsal 1f450a680f test: use ~/.bashrc instead of /etc/bash.bashrc
/etc/bash.bashrc appears to be Debian-specific[0] (or specific to bash
versions compiled with -DSYS_BASHRC), which doesn't seem to be the case
for C8S. Let's use ~/.bashrc instead to make the CIs happy again.

[0] https://sources.debian.org/src/bash/5.1-6/debian/README/#L50-L56
2022-01-31 17:47:01 +01:00
Frantisek Sumsal db357e9a89 test: make the code less error-prone 2022-01-31 16:49:09 +01:00
Ludwig Nussel 48f3bc5cc4 test: add shutdown test
Wraps nspawn to be able to use pexpect. The test logs in on the console
and runs screen. In one screen window it types in shutdown commands and
checks whether a wall message was sent to the other.
2022-01-25 17:43:13 +01:00