ephemeral: Add test-basic subcommand - #393
Conversation
A quick "does this image boot healthy" check is what most CI consumers of bcvk end up writing by hand with run-ssh, so give it a name: `bcvk ephemeral test-basic IMAGE` is shorthand for run-ssh with `systemctl is-system-running --wait`, which also lists the failed units when the system comes up degraded, and exits non-zero unless it reaches "running". Now that bcvk masks bootloader-update.service, stock images reach "running" in an ephemeral VM, so a degraded state really means something is wrong with the image. Rather than duplicating run-ssh's VM lifecycle and SSH handling, it re-executes bcvk as run-ssh with the same arguments, so it can't drift from it. The options are still declared (flattened from `ephemeral run`) so they are validated up front and show up in --help and the man page. Based on bootc-dev#244 by Xiaofeng Wang and the automated follow-up bootc-dev#357, reworked per review there. Closes: bootc-dev#356 Generated-by: AI Signed-off-by: Colin Walters <walters@verbum.org>
|
|
||
| Add virtio-serial device with output to file (format: name:/path/to/file) | ||
|
|
||
| **--execute**=*EXECUTE* |
There was a problem hiding this comment.
Hmm I know these are auto-generated but I don't think they're useful for this.
I guess it's hard to fix without carefully factoring out common options.
There was a problem hiding this comment.
Agreed, not fixing it here: filed cgwalters-forge/tracker#256 on splitting the session/container options out of CommonVmOpts/CommonPodmanOptions so wrappers like test-basic only take (and document) the VM ones. @cgwalters, say if you want it raised upstream.
|
|
Add
bcvk ephemeral test-basic IMAGE, a smoke test that boots the image and checks that systemd reaches "running". It re-executes bcvk (keeping argv[0]) asephemeral run-ssh IMAGE -- /bin/sh -c SCRIPT, where the script runstimeout 600 systemctl is-system-running --wait. On success its only output is the wordrunning. Otherwise it lists the failed units and exits 1, or, if boot hasn't finished 10 minutes after SSH came up (e.g. a oneshot with no timeout), lists the pending jobs and exits 124; the man page documents these exit statuses.This takes over #357 (bootc-bot's automated rework of #244 by Xiaofeng Wang), reimplemented in one commit rather than carrying #357's three, since its hand-rolled VM lifecycle and ContainerCleanup refactor go away. Per the review on #357:
/proc/self/exe ephemeral run-sshwith the same arguments instead of duplicating run-ssh..run().systemctl is-system-running --waitrather thansystemctl status --no-pager: now that bcvk masks bootloader-update.service (d857ff7), stock images reach "running", andsystemctl statusexits 0 on a degraded system, so it would not catch a failing unit.A new fixture image with an always-failing unit covers the degraded case.
Testing, on 16-core RHEL 10 devspaces (cgwalters-devspace-36474905273, and cgwalters-devspace-36478996158 for the current head 244cad8):
make validate(fmt, clippy, docs) andcargo test --workspace --exclude integration-testspassed, including the new argv rewrite unit test.bcvk ephemeral test-basic quay.io/centos-bootc/centos-bootc:stream10printedrunningand exited 0, with the re-exec's argv[0] being the original bcvk path. On the failing-unit fixture it printeddegradedplus the failed unit and exited 1;systemctl status --no-pagerexited 0 there.sleep infinityoneshot, listed the pending jobs and exited 124.test_ephemeral_test_basicandtest_ephemeral_test_basic_degradedpassed against centos-bootc:stream10 (and, on the first head,test_run_ephemeral_ssh_system_commandandtest_run_ephemeral_ssh_broken_image_cleanup). The full integration suite and other images were not run.Fixes #356
Related: #357, #244
The
Signed-off-by: Colin Walters <walters@verbum.org>on these commits was added on cgwalters's approval of the review draft: cgwalters-forge#10 (review)Generated-by: https://github.com/cgwalters/#llms