Skip to content

Commit 50d0143

Browse files
cgwaltershenrywang
andcommitted
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>
1 parent e782c32 commit 50d0143

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

crates/xtask/src/tmt.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,13 @@ pub(crate) fn run_tmt(sh: &Shell, args: &RunTmtArgs) -> Result<()> {
344344
// Note: provision must come before plan for connect to work properly
345345
let context = context.clone();
346346
let how = ["--how=connect", "--guest=localhost", "--user=root"];
347+
let env = ["TMT_SCRIPTS_DIR=/var/lib/tmt/scripts", "BCVK_EXPORT=1"]
348+
.into_iter()
349+
.chain(args.env.iter().map(|v| v.as_str()))
350+
.flat_map(|v| ["--environment", v]);
347351
let test_result = cmd!(
348352
sh,
349-
"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}"
353+
"tmt {context...} run --id {run_id} --all {env...} provision {how...} --port {ssh_port_str} --key {key_path} plan --name {plan}"
350354
)
351355
.run();
352356

tmt/tests/booted/bootc_testlib.nu

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,10 @@ export def reboot [] {
1212

1313
tmt-reboot
1414
}
15+
16+
# True if we're running in bcvk with `--bind-storage-ro` and
17+
# we can expect to be able to pull container images from the host.
18+
# See xtask.rs
19+
export def have_hostexports [] {
20+
$env.BCVK_EXPORT? == "1"
21+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Verify that we have host container storage with bcvk
2+
use std assert
3+
use tap.nu
4+
use ../bootc_testlib.nu
5+
6+
if not (bootc_testlib have_hostexports) {
7+
print "No host exports, skipping"
8+
exit 0
9+
}
10+
11+
bootc status
12+
let st = bootc status --json | from json
13+
let is_composefs = ($st.status.booted.composefs? != null)
14+
if $is_composefs {
15+
# TODO we don't have imageDigest yet in status
16+
exit 0
17+
}
18+
19+
let booted = $st.status.booted
20+
let imgref = $booted.image.image.image
21+
let digest = $booted.image.imageDigest
22+
let imgref_untagged = $imgref | split row ':' | first
23+
let digested_imgref = $"($imgref_untagged)@($digest)"
24+
systemd-run -dqP /bin/env
25+
podman inspect $digested_imgref
26+
27+
tap ok

0 commit comments

Comments
 (0)