diff --git a/crates/xtask/src/tmt.rs b/crates/xtask/src/tmt.rs index 019294ca..ce7b3036 100644 --- a/crates/xtask/src/tmt.rs +++ b/crates/xtask/src/tmt.rs @@ -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(); diff --git a/tmt/tests/booted/bootc_testlib.nu b/tmt/tests/booted/bootc_testlib.nu index 45089a35..5f15586a 100644 --- a/tmt/tests/booted/bootc_testlib.nu +++ b/tmt/tests/booted/bootc_testlib.nu @@ -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" +} diff --git a/tmt/tests/booted/readonly/017-test-bound-storage.nu b/tmt/tests/booted/readonly/017-test-bound-storage.nu new file mode 100644 index 00000000..c8776185 --- /dev/null +++ b/tmt/tests/booted/readonly/017-test-bound-storage.nu @@ -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