Skip to content

Commit 5009041

Browse files
committed
Code changes for tmt test refactor
1 parent 427aca3 commit 5009041

28 files changed

Lines changed: 1268 additions & 401 deletions

File tree

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@
2525
!target/packages/
2626
# And finally of course all the Rust sources
2727
!crates/
28+
!hack/

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ bootc.tar.zst
55

66
# Added by cargo
77
/target
8+
9+
# Registry TLS certificates (generated at build time)
10+
/hack/.registry-certs

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,22 @@ RUN --mount=type=bind,from=packaging,target=/run/packaging \
7474
--mount=type=bind,from=packages,target=/build-packages \
7575
--network=none \
7676
/run/packaging/install-rpm-and-setup /build-packages
77+
# Install registry CA certificate for secure registry access in tests
78+
RUN --mount=type=bind,from=src,target=/run/src <<EORUN
79+
set -xeuo pipefail
80+
# Install the registry CA certificate if it exists
81+
# This allows test VMs to trust the registry's TLS certificate
82+
ls -la /run/src/src
83+
if [ -f /run/src/src/hack/.registry-certs/ca.pem ]; then
84+
echo "Installing registry CA certificate to trust store..."
85+
cp /run/src/src/hack/.registry-certs/ca.pem /usr/share/pki/ca-trust-source/anchors/bootc-registry-ca.crt
86+
update-ca-trust
87+
echo "✓ Registry CA certificate installed"
88+
else
89+
echo "Note: Registry CA certificate not found - registry will need --tls-verify=false"
90+
echo "To enable secure registry access, run: hack/setup-registry-certs.sh"
91+
exit 1
92+
fi
93+
EORUN
7794
# Finally, testour own linting
7895
RUN bootc container lint --fatal-warnings

Justfile

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ base_img := "localhost/bootc"
1717
integration_img := base_img + "-integration"
1818
# Has a synthetic upgrade
1919
integration_upgrade_img := integration_img + "-upgrade"
20+
# Registry image for multi-VM testing
21+
integration_registry_img := integration_img + "-registry"
2022

2123
# ostree: The default
2224
# composefs-sealeduki-sdboot: A system with a sealed composefs using systemd-boot
@@ -41,6 +43,7 @@ buildargs := "--build-arg=base=" + base + " --build-arg=variant=" + variant
4143
# Note commonly you might want to override the base image via e.g.
4244
# `just build --build-arg=base=quay.io/fedora/fedora-bootc:42`
4345
build: package
46+
./hack/setup-registry-certs.sh
4447
podman build {{base_buildargs}} -t {{base_img}}-bin {{buildargs}} .
4548
./tests/build-sealed {{variant}} {{base_img}}-bin {{base_img}} {{buildroot_base}}
4649

@@ -98,7 +101,9 @@ copy-packages-from PATH:
98101

99102
# This container image has additional testing content and utilities
100103
build-integration-test-image: build
101-
cd hack && podman build {{base_buildargs}} -t {{integration_img}}-bin -f Containerfile .
104+
# Generate TLS certificates for registry trust (idempotent - skips if exists)
105+
./hack/setup-registry-certs.sh
106+
podman build {{base_buildargs}} -t {{integration_img}}-bin -f hack/Containerfile .
102107
./tests/build-sealed {{variant}} {{integration_img}}-bin {{integration_img}} {{buildroot_base}}
103108
# Keep these in sync with what's used in hack/lbi
104109
podman pull -q --retry 5 --retry-delay 5s quay.io/curl/curl:latest quay.io/curl/curl-base:latest registry.access.redhat.com/ubi9/podman:latest
@@ -140,18 +145,28 @@ validate:
140145
#
141146
# To run an individual test, pass it as an argument like:
142147
# `just test-tmt readonly`
143-
test-tmt *ARGS: build-integration-test-image _build-upgrade-image
148+
test-tmt *ARGS: build-integration-test-image _build-upgrade-image _build-registry-image
144149
@just test-tmt-nobuild {{ARGS}}
145150

146151
# Generate a local synthetic upgrade
147152
_build-upgrade-image:
148153
cat tmt/tests/Dockerfile.upgrade | podman build -t {{integration_upgrade_img}}-bin --from={{integration_img}}-bin -
149154
./tests/build-sealed {{variant}} {{integration_upgrade_img}}-bin {{integration_upgrade_img}} {{buildroot_base}}
150155

156+
# Build a registry VM image for multi-VM testing
157+
# Uses Podman Quadlet for idiomatic container-as-service setup
158+
_build-registry-image:
159+
# Generate TLS certificates for the registry (idempotent - skips if exists)
160+
./hack/setup-registry-certs.sh
161+
# Build registry image with Quadlet configuration
162+
# Pre pull registry container to be used as a LBI
163+
podman pull quay.io/libpod/registry:2.8.2
164+
podman build -t {{integration_registry_img}} -f hack/Containerfile.registry --build-arg=base={{buildroot_base}} .
165+
151166
# Assume the localhost/bootc-integration image is up to date, and just run tests.
152167
# Useful for iterating on tests quickly.
153168
test-tmt-nobuild *ARGS:
154-
cargo xtask run-tmt --env=BOOTC_variant={{variant}} --upgrade-image={{integration_upgrade_img}} {{integration_img}} {{ARGS}}
169+
cargo xtask run-tmt --env=BOOTC_variant={{variant}} --upgrade-image={{integration_upgrade_img}} --registry-image={{integration_registry_img}} {{integration_img}} {{ARGS}}
155170

156171
# Cleanup all test VMs created by tmt tests
157172
tmt-vm-cleanup:

0 commit comments

Comments
 (0)