Skip to content

Commit a821bc1

Browse files
authored
Merge pull request #792 from ckyrouac/lbi-install-tmt
tests: Add tmt test for bootc install with LBI
2 parents eea3996 + 0f09ae2 commit a821bc1

File tree

9 files changed

+45
-2
lines changed

9 files changed

+45
-2
lines changed

plans/test-21-logically-bound.fmf renamed to plans/test-21-logically-bound-switch.fmf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ provision:
44
# Generated by make test-tmt
55
image: file://./target/testvm/disk.qcow2
66
disk: 20
7-
summary: Execute logically bound images tests
7+
summary: Execute logically bound images tests for switching images
88
execute:
99
how: tmt
1010
# We avoid writing nontrivial shell script as a general rule,
1111
# so this is written in nu.
12-
script: exec nu tests/booted/test-logically-bound.nu
12+
script: exec nu tests/booted/test-logically-bound-switch.nu
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
environment+:
2+
TMT_PLUGINS: ./tests/plugins
3+
provision:
4+
how: bootc
5+
add_deps: false
6+
containerfile: tests/containerfiles/lbi/Containerfile
7+
containerfile_workdir: tests/containerfiles/lbi
8+
disk: 20
9+
summary: Execute logically bound images tests for installing image
10+
execute:
11+
how: tmt
12+
script: exec nu tests/booted/test-logically-bound-install.nu
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
use std assert
2+
use tap.nu
3+
4+
let images = podman --storage-opt=additionalimagestore=/usr/lib/bootc/storage images --format {{.Repository}} | from csv --noheaders
5+
print "IMAGES:"
6+
podman --storage-opt=additionalimagestore=/usr/lib/bootc/storage images # for debugging
7+
assert ($images | any {|item| $item.column1 == "quay.io/curl/curl"})
8+
assert ($images | any {|item| $item.column1 == "quay.io/curl/curl-base"})
9+
10+
tap ok
File renamed without changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM localhost/bootc
2+
3+
COPY ./usr/. /usr
4+
5+
RUN ln -s /usr/share/containers/systemd/curl.container /usr/lib/bootc/bound-images.d/curl.container && \
6+
ln -s /usr/share/containers/systemd/curl-base.image /usr/lib/bootc/bound-images.d/curl-base.image
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[Image]
2+
Image=quay.io/curl/curl-base:latest
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[Container]
2+
Image=quay.io/curl/curl:latest
3+
GlobalArgs=--storage-opt=additionalimagestore=/usr/lib/bootc/storage
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This is not symlinked to bound-images.d so it should not be pulled.
2+
# It's here to represent an app image that exists
3+
# in a bootc image but is not logically bound.
4+
[Image]
5+
Image=registry.redhat.io/jboss-webserver-5/jws5-rhel8-operator:latest
6+
AuthFile=/root/auth.json

xtask/src/xtask.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use fn_error_context::context;
1111
use xshell::{cmd, Shell};
1212

1313
const NAME: &str = "bootc";
14+
const TEST_IMAGES: &[&str] = &["quay.io/curl/curl-base:latest", "quay.io/curl/curl:latest"];
1415

1516
fn main() {
1617
if let Err(e) = try_main() {
@@ -185,6 +186,9 @@ fn test_tmt(sh: &Shell) -> Result<()> {
185186

186187
cmd!(sh, "cargo run -p tests-integration run-vm prepare-tmt").run()?;
187188

189+
// pull some small images that are used for LBI installation tests
190+
cmd!(sh, "podman pull {TEST_IMAGES...}").run()?;
191+
188192
for (_prio, name) in all_plan_files {
189193
// cc https://pagure.io/testcloud/pull-request/174
190194
cmd!(sh, "rm -vf /var/tmp/tmt/testcloud/images/disk.qcow2").run()?;

0 commit comments

Comments
 (0)