Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ accepted!
- A development environment (toolbox or a host) with a Rust and C compiler, etc.
While this isn't specific to bootc, you will find the experience of working on Rust
is greatly aided with use of e.g. [rust-analyzer](https://github.com/rust-lang/rust-analyzer/).
- Install [bcvk](https://github.com/bootc-dev/bcvk).
- Install [bcvk](https://github.com/bootc-dev/bcvk). For running TMT
integration tests, also install `tmt` and `libvirt`
(e.g. `dnf install bcvk tmt libvirt`).

## Ensure you're familiar with a bootc system

Expand Down
3 changes: 3 additions & 0 deletions crates/lib/src/bootc_composefs/switch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ pub(crate) async fn switch_composefs(

if new_spec == host.spec {
println!("Image specification is unchanged.");
if opts.apply && host.status.staged.is_some() {
crate::reboot::reboot()?;
}
return Ok(());
}

Expand Down
3 changes: 3 additions & 0 deletions crates/lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1398,6 +1398,9 @@ async fn switch_ostree(

if new_spec == host.spec {
println!("Image specification is unchanged.");
if opts.apply && host.status.staged.is_some() {
crate::reboot::reboot()?;
}
return Ok(());
}

Expand Down
13 changes: 4 additions & 9 deletions tmt/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# Run integration test locally
# TMT integration tests

In the bootc CI, integration tests are executed via Packit on the Testing Farm. In addition, the integration tests can also be run locally on a developer's machine, which is especially valuable for debugging purposes.
In the bootc CI, integration tests are executed via Packit on the Testing Farm.

To run integration tests locally, you need to [install tmt](https://tmt.readthedocs.io/en/stable/guide.html#the-first-steps) and `provision-virtual` plugin in this case. Be ready with `dnf install -y tmt+provision-virtual`. Then, use `tmt run -vvvvv plans -n integration` command to run the all integration tests.

To run integration tests on different distros, just change `image: fedora-rawhide` in https://github.com/bootc-dev/bootc/blob/9d15eedea0d54a4dbc15d267dbdb055817336254/tmt/plans/integration.fmf#L6.

The available images value can be found from https://tmt.readthedocs.io/en/stable/plugins/provision.html#images.

Enjoy integration test local running!
See [CONTRIBUTING.md](../CONTRIBUTING.md#running-tmt-integration-tests) for
instructions on running them locally.
12 changes: 8 additions & 4 deletions tmt/tests/booted/test-image-upgrade-reboot.nu
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
# This test does:
# bootc image copy-to-storage
# podman build <from that image>
# bootc switch <into that image> --apply
# bootc switch <into that image> (stage only)
# bootc switch --apply <same image> (spec unchanged, must still reboot)
# Verify we boot into the new image
#
# For composefs builds, it additionally verifies that composefs is
Expand Down Expand Up @@ -65,10 +66,13 @@ def initial_build [] {
$st.status.booted.composefs.verity | save /var/original-verity
}

# Now, switch into the new image
print $"Applying ($imgsrc)"
# Now, switch into the new image. First stage it, then run switch --apply for
# the same target. This exercises the case where --apply must still reboot for
# staged deployments.
print $"Staging ($imgsrc)"

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.

We're technically losing coverage here on doing a one-shot switch --apply which both had to stage and reboot together.

It didn't feel worth adding another reboot to test this since it's trivial (while the early return reboot into staged here is a more subtle gotcha), but happy to do so if folks prefer.

bootc switch --transport containers-storage ($imgsrc)
tmt-reboot
print "Re-running with --apply (spec unchanged, should still reboot)"
tmt-reboot -c $"bootc switch --apply --transport containers-storage ($imgsrc)"
}

# Check we have the updated image
Expand Down
Loading