1
0
mirror of https://github.com/containers/bootc.git synced 2026-02-05 15:45:53 +01:00

tests: Use --bind-storage-ro with bcvk

To make it easier to do upgrade tests.

Signed-off-by: Colin Walters <walters@verbum.org>
Co-authored-by: Xiaofeng Wang <henrywangxf@me.com>
Signed-off-by: Colin Walters <walters@verbum.org>
This commit is contained in:
Colin Walters
2025-11-20 13:36:10 -05:00
parent 17ff4bcd48
commit 7f2b73d51d
3 changed files with 39 additions and 1 deletions

View File

@@ -344,9 +344,13 @@ pub(crate) fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
// Note: provision must come before plan for connect to work properly
let context = context.clone();
let how = ["--how=connect", "--guest=localhost", "--user=root"];
let env = ["TMT_SCRIPTS_DIR=/var/lib/tmt/scripts", "BCVK_EXPORT=1"]
.into_iter()
.chain(args.env.iter().map(|v| v.as_str()))
.flat_map(|v| ["--environment", v]);
let test_result = cmd!(
sh,
"tmt {context...} run --id {run_id} --all -e TMT_SCRIPTS_DIR=/var/lib/tmt/scripts provision {how...} --port {ssh_port_str} --key {key_path} plan --name {plan}"
"tmt {context...} run --id {run_id} --all {env...} provision {how...} --port {ssh_port_str} --key {key_path} plan --name {plan}"
)
.run();

View File

@@ -12,3 +12,10 @@ export def reboot [] {
tmt-reboot
}
# True if we're running in bcvk with `--bind-storage-ro` and
# we can expect to be able to pull container images from the host.
# See xtask.rs
export def have_hostexports [] {
$env.BCVK_EXPORT? == "1"
}

View File

@@ -0,0 +1,27 @@
# Verify that we have host container storage with bcvk
use std assert
use tap.nu
use ../bootc_testlib.nu
if not (bootc_testlib have_hostexports) {
print "No host exports, skipping"
exit 0
}
bootc status
let st = bootc status --json | from json
let is_composefs = ($st.status.booted.composefs? != null)
if $is_composefs {
# TODO we don't have imageDigest yet in status
exit 0
}
let booted = $st.status.booted
let imgref = $booted.image.image.image
let digest = $booted.image.imageDigest
let imgref_untagged = $imgref | split row ':' | first
let digested_imgref = $"($imgref_untagged)@($digest)"
systemd-run -dqP /bin/env
podman inspect $digested_imgref
tap ok