Skip to content

ephemeral: Add test-basic subcommand - #393

Merged
cgwalters merged 1 commit into
bootc-dev:mainfrom
cgwalters-forge:bot/ephemeral-test-basic
Oct 1, 2026
Merged

cgwalters merged 1 commit into
bootc-dev:mainfrom
cgwalters-forge:bot/ephemeral-test-basic

Conversation

@cgwalters-bot

Copy link
Copy Markdown
Contributor

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]) as ephemeral run-ssh IMAGE -- /bin/sh -c SCRIPT, where the script runs timeout 600 systemctl is-system-running --wait. On success its only output is the word running. 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:

  • It re-execs /proc/self/exe ephemeral run-ssh with the same arguments instead of duplicating run-ssh.
  • The healthy-image integration test just uses .run().
  • It checks systemctl is-system-running --wait rather than systemctl status --no-pager: now that bcvk masks bootloader-update.service (d857ff7), stock images reach "running", and systemctl status exits 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) and cargo test --workspace --exclude integration-tests passed, including the new argv rewrite unit test.
  • bcvk ephemeral test-basic quay.io/centos-bootc/centos-bootc:stream10 printed running and exited 0, with the re-exec's argv[0] being the original bcvk path. On the failing-unit fixture it printed degraded plus the failed unit and exited 1; systemctl status --no-pager exited 0 there.
  • The same script with a 20s timeout, on an image with a sleep infinity oneshot, listed the pending jobs and exited 124.
  • Integration tests test_ephemeral_test_basic and test_ephemeral_test_basic_degraded passed against centos-bootc:stream10 (and, on the first head, test_run_ephemeral_ssh_system_command and test_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

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*

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@cgwalters-bot

cgwalters-bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author

integration-tests (1) failure looks like a flake: test_to_base_disk_with_filesystem (untouched by this PR) failed with Failed to define default pool: error: failed to connect to the hypervisor ... /run/user/1001/libvirt/libvirt-sock: No such file or directory, while the libvirt tests before and after it in the same partition passed; the new test-basic tests aren't in that partition. @cgwalters, it needs a rerun of that job: https://github.com/bootc-dev/bcvk/actions/runs/36787860976/job/110136834025

@cgwalters
cgwalters merged commit 3173ba5 into bootc-dev:main Oct 1, 2026
37 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rebase https://github.com/bootc-dev/bcvk/pull/244 address comments do a new PR

2 participants