diff --git a/plans/test-21-logically-bound.fmf b/plans/test-21-logically-bound-switch.fmf similarity index 63% rename from plans/test-21-logically-bound.fmf rename to plans/test-21-logically-bound-switch.fmf index a78f68988..fbdd2f7ac 100644 --- a/plans/test-21-logically-bound.fmf +++ b/plans/test-21-logically-bound-switch.fmf @@ -4,9 +4,9 @@ provision: # Generated by make test-tmt image: file://./target/testvm/disk.qcow2 disk: 20 -summary: Execute logically bound images tests +summary: Execute logically bound images tests for switching images execute: how: tmt # We avoid writing nontrivial shell script as a general rule, # so this is written in nu. - script: exec nu tests/booted/test-logically-bound.nu + script: exec nu tests/booted/test-logically-bound-switch.nu diff --git a/plans/test-22-logically-bound-install.fmf b/plans/test-22-logically-bound-install.fmf new file mode 100644 index 000000000..0445cac42 --- /dev/null +++ b/plans/test-22-logically-bound-install.fmf @@ -0,0 +1,12 @@ +environment+: + TMT_PLUGINS: ./tests/plugins +provision: + how: bootc + add_deps: false + containerfile: tests/containerfiles/lbi/Containerfile + containerfile_workdir: tests/containerfiles/lbi + disk: 20 +summary: Execute logically bound images tests for installing image +execute: + how: tmt + script: exec nu tests/booted/test-logically-bound-install.nu diff --git a/tests/booted/test-logically-bound-install.nu b/tests/booted/test-logically-bound-install.nu new file mode 100644 index 000000000..44facc319 --- /dev/null +++ b/tests/booted/test-logically-bound-install.nu @@ -0,0 +1,10 @@ +use std assert +use tap.nu + +let images = podman --storage-opt=additionalimagestore=/usr/lib/bootc/storage images --format {{.Repository}} | from csv --noheaders +print "IMAGES:" +podman --storage-opt=additionalimagestore=/usr/lib/bootc/storage images # for debugging +assert ($images | any {|item| $item.column1 == "quay.io/curl/curl"}) +assert ($images | any {|item| $item.column1 == "quay.io/curl/curl-base"}) + +tap ok diff --git a/tests/booted/test-logically-bound.nu b/tests/booted/test-logically-bound-switch.nu similarity index 100% rename from tests/booted/test-logically-bound.nu rename to tests/booted/test-logically-bound-switch.nu diff --git a/tests/containerfiles/lbi/Containerfile b/tests/containerfiles/lbi/Containerfile new file mode 100644 index 000000000..bf9f8e1ef --- /dev/null +++ b/tests/containerfiles/lbi/Containerfile @@ -0,0 +1,6 @@ +FROM localhost/bootc + +COPY ./usr/. /usr + +RUN ln -s /usr/share/containers/systemd/curl.container /usr/lib/bootc/bound-images.d/curl.container && \ + ln -s /usr/share/containers/systemd/curl-base.image /usr/lib/bootc/bound-images.d/curl-base.image diff --git a/tests/containerfiles/lbi/usr/share/containers/systemd/curl-base.image b/tests/containerfiles/lbi/usr/share/containers/systemd/curl-base.image new file mode 100644 index 000000000..5c818c0fb --- /dev/null +++ b/tests/containerfiles/lbi/usr/share/containers/systemd/curl-base.image @@ -0,0 +1,2 @@ +[Image] +Image=quay.io/curl/curl-base:latest diff --git a/tests/containerfiles/lbi/usr/share/containers/systemd/curl.container b/tests/containerfiles/lbi/usr/share/containers/systemd/curl.container new file mode 100644 index 000000000..b3788916c --- /dev/null +++ b/tests/containerfiles/lbi/usr/share/containers/systemd/curl.container @@ -0,0 +1,3 @@ +[Container] +Image=quay.io/curl/curl:latest +GlobalArgs=--storage-opt=additionalimagestore=/usr/lib/bootc/storage diff --git a/tests/containerfiles/lbi/usr/share/containers/systemd/jboss-webserver-5.image b/tests/containerfiles/lbi/usr/share/containers/systemd/jboss-webserver-5.image new file mode 100644 index 000000000..6b04d82dc --- /dev/null +++ b/tests/containerfiles/lbi/usr/share/containers/systemd/jboss-webserver-5.image @@ -0,0 +1,6 @@ +# This is not symlinked to bound-images.d so it should not be pulled. +# It's here to represent an app image that exists +# in a bootc image but is not logically bound. +[Image] +Image=registry.redhat.io/jboss-webserver-5/jws5-rhel8-operator:latest +AuthFile=/root/auth.json diff --git a/xtask/src/xtask.rs b/xtask/src/xtask.rs index df55e2ffb..3903450c0 100644 --- a/xtask/src/xtask.rs +++ b/xtask/src/xtask.rs @@ -8,6 +8,7 @@ use fn_error_context::context; use xshell::{cmd, Shell}; const NAME: &str = "bootc"; +const TEST_IMAGES: &[&str] = &["quay.io/curl/curl-base:latest", "quay.io/curl/curl:latest"]; fn main() { if let Err(e) = try_main() { @@ -182,6 +183,9 @@ fn test_tmt(sh: &Shell) -> Result<()> { cmd!(sh, "cargo run -p tests-integration run-vm prepare-tmt").run()?; + // pull some small images that are used for LBI installation tests + cmd!(sh, "podman pull {TEST_IMAGES...}").run()?; + for (_prio, name) in all_plan_files { // cc https://pagure.io/testcloud/pull-request/174 cmd!(sh, "rm -vf /var/tmp/tmt/testcloud/images/disk.qcow2").run()?;