Skip to content

Commit

Permalink
tests: Add tmt test for bootc install with LBI
Browse files Browse the repository at this point in the history
Along with the test, this will install the LBIs on the machine running
the tests prior to running the tests. Also refactors the existing LBI
test into a separate test plan to make room for the install tests.

Signed-off-by: Chris Kyrouac <[email protected]>
  • Loading branch information
ckyrouac committed Sep 18, 2024
1 parent 355810f commit c74f64d
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 12 additions & 0 deletions plans/test-22-logically-bound-install.fmf
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions tests/booted/test-logically-bound-install.nu
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
6 changes: 6 additions & 0 deletions tests/containerfiles/lbi/Containerfile
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Image]
Image=quay.io/curl/curl-base:latest
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Container]
Image=quay.io/curl/curl:latest
GlobalArgs=--storage-opt=additionalimagestore=/usr/lib/bootc/storage
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Image]
Image=registry.redhat.io/jboss-webserver-5/jws5-rhel8-operator:latest
AuthFile=/root/auth.json
7 changes: 7 additions & 0 deletions xtask/src/xtask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ 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 quay.io/curl/curl-base:latest quay.io/curl/curl:latest"
)
.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()?;
Expand Down

0 comments on commit c74f64d

Please sign in to comment.