Skip to content

tests: Port test-switch-zstd-chunked to Rust - #2550

Merged
cgwalters merged 2 commits into
bootc-dev:mainfrom
andrewdunndev:tests/port-switch-zstd-chunked
Oct 9, 2026
Merged

cgwalters merged 2 commits into
bootc-dev:mainfrom
andrewdunndev:tests/port-switch-zstd-chunked

Conversation

@andrewdunndev

Copy link
Copy Markdown
Contributor

First port for #2547. test-switch-zstd-chunked.nu becomes bootc-integration-tests booted switch-zstd-chunked, and its tmt entry runs that instead of nu. I picked it because it builds an image on the target, pushes it, switches to it and reboots, so it brings over pieces many other tests share: TAP output, dispatch on TMT_REBOOT_COUNT, bootc status --json and the UKI Containerfile helper from tap.nu.

Ported tests are modules under a new booted subcommand in tests-integration. The bootc-tests subpackage already installs that binary in the test image, so packaging doesn't change. Your issue suggests a separate bootc-tests binary; would you rather have that?

cargo xtask update-generated now also reads the number/tmt/extra header from // comments in crates/tests-integration/src/booted/*.rs, so plan-50 keeps its name, summary, duration and skip_if_ostree (for #2402). Every failure exits 1, which tmt reports as a failure: checks return errors instead of panicking (a panic's 101 is a tmt error), and a failing command no longer passes its own exit code through as nushell did (podman's 125 was a tmt error).

Packit

Packit, and gating runs using the same prepare steps, boot an image built from Containerfile.packit, which doesn't install bootc-tests, and Packit's Copr build doesn't pass --with tests. So the plan is now disabled outside running_env=image_mode, with the same rule as test-27. Only cargo xtask run-tmt applies skip_if_ostree, so today plan-50 runs and passes on Packit's ostree images (all four tier-1 targets on #2314); this drops those runs, and gating's, until bootc-tests is built there. Every later port hits the same gap, so I'd look at getting bootc-tests into the Packit image next.

flowchart TD
    header["header comments in booted/switch_zstd_chunked.rs"] -->|cargo xtask update-generated| plan["plan-50 runs<br/>bootc-integration-tests booted switch-zstd-chunked"]
    plan --> env{running_env}
    env -->|image_mode| bcvk["run-tmt boots the Dockerfile image,<br/>which installs bootc-tests"]
    env -->|Packit and gating| off["plan disabled:<br/>Containerfile.packit has no bootc-tests"]
Loading

Testing

In a Fedora 44 container, make validate, cargo xtask update-generated direct --check and the tests-integration and xtask unit tests pass. With bootc, podman, skopeo and tmt-reboot stubbed out, the port and the nushell original print the same TAP lines on both boots and when each check fails, pass and fail in the same cases, and generate the same UKI stages. In a test VM, just test-tmt switch-zstd-chunked passes on composefs BLS and unsealed UKI.

The nushell tests keep breaking on subtle behaviour changes between
nushell versions, so the plan is to move them to Rust with xshell. This
is the first one. It builds an image on the target, pushes it, switches
to it and reboots, so it needs pieces many of the others share: TAP
output, dispatch on TMT_REBOOT_COUNT, `bootc status --json`, and the
UKI Containerfile helper from tap.nu.

The tests become subcommands of a new `booted` group in
bootc-integration-tests, which the bootc-tests subpackage already puts
in the test image. Every failure exits 1, which tmt counts as a test
failure: checks return errors rather than panicking (a panic exits 101,
which tmt reports as an error), and a failing command no longer passes
its own exit code through the way nushell did. Nothing runs this yet;
the next commit points tmt at it.

Related: bootc-dev#2547
Assisted-by: AI
Signed-off-by: Andrew Dunn <andrew@dunn.dev>
The tmt generator only finds scripts in tmt/tests/booted, so nothing
runs the Rust port from the previous commit. Teach it to read the same
number/tmt/extra header from `//` comments in
crates/tests-integration/src/booted/*.rs, and to generate each test
there as `bootc-integration-tests booted <module>`. plan-50 keeps its
name and now runs the Rust port, and the nushell version goes.

The plan is now disabled outside running_env=image_mode, as test-27
is. Packit, and the gating runs sharing its prepare steps, boot an
image built from Containerfile.packit, which doesn't install
bootc-tests, and Packit's Copr build doesn't pass `--with tests`. That
drops this test's runs on Packit's ostree images, and in gating, until
bootc-tests is built there.

Related: bootc-dev#2547
Assisted-by: AI
Signed-off-by: Andrew Dunn <andrew@dunn.dev>
@bootc-bot
bootc-bot Bot requested a review from jeckersb October 6, 2026 01:08

@cgwalters cgwalters left a comment

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.

Neat! Thanks for starting the ball rolling on this. I personally think this looks nicer indeed.

Comment thread tmt/tests/tests.fmf
adjust:
- when: running_env != image_mode
enabled: false
because: only the image_mode test image installs bootc-tests

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.

Actually though what we want to do is create e.g. bootc-tests.rpm or so.

@@ -0,0 +1,178 @@
// number: 50

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.

I think this is ok for now but as a followup since we're porting anyways let's require some structured metadata here. I think YAML frontmatter would be appropriate, we could perhaps extract that from rustdoc and avoid parsing rust code on our own?

Or just require

// # tmt-begin
...
/// # tmt-end

or so?

@cgwalters
cgwalters enabled auto-merge (rebase) October 9, 2026 19:25
@cgwalters
cgwalters merged commit ba0897d into bootc-dev:main Oct 9, 2026
93 of 96 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.

2 participants