Skip to content

Commit d72b344

Browse files
committed
tests: Fix install-outside-container for composefs+grub
The initial change to use locally-built images had two additional issues on composefs: 1. containers-storage: transport fails on composefs's read-only root with "mkdir /.local: read-only file system". Fix by exporting the image to an OCI layout directory on writable /var/tmp instead. 2. run_install() was masking /sysroot/ostree and removing bootupd update metadata, which composefs needs for bootloader installation and boot binaries. Fix by making run_install() skip these ostree-specific workarounds on composefs systems. Note: the composefs install-outside-container code path still has a separate bug ("Shared boot binaries not found" in boot.rs:745) that needs fixing in the Rust code. Assisted-by: Claude Code (Opus 4) Signed-off-by: ckyrouac <ckyrouac@redhat.com>
1 parent 6601a67 commit d72b344

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

tmt/tests/booted/tap.nu

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,21 @@ export def get_target_image [] {
5555

5656
# Run a bootc install command in an isolated mount namespace.
5757
# This handles the common setup needed for install tests run outside a container.
58+
# For ostree: masks off bootupd updates and /sysroot/ostree to reproduce
59+
# https://github.com/bootc-dev/bootc/issues/1778
60+
# For composefs: only removes bound images (bootupd metadata and boot
61+
# binaries under /sysroot/ostree are needed for installation).
5862
export def run_install [cmd: string] {
63+
let is_cfs = (is_composefs)
64+
let mask_cmds = if $is_cfs {
65+
"true"
66+
} else {
67+
"if test -d /sysroot/ostree; then mount --bind /usr/share/empty /sysroot/ostree; fi\nrm -vrf /usr/lib/bootupd/updates"
68+
}
5969
systemd-run -p MountFlags=slave -qdPG -- /bin/sh -c $"
6070
set -xeuo pipefail
6171
bootc usr-overlay
62-
if test -d /sysroot/ostree; then mount --bind /usr/share/empty /sysroot/ostree; fi
63-
rm -vrf /usr/lib/bootupd/updates
72+
($mask_cmds)
6473
rm -vrf /usr/lib/bootc/bound-images.d
6574
($cmd)
6675
"

tmt/tests/booted/test-install-outside-container.nu

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ use std assert
77
use tap.nu
88

99
# Use the locally-built image which has updated bootupd with compatible
10-
# EFI update metadata, matching the pattern used by test-32/37/38.
10+
# EFI update metadata. Export to OCI layout on a writable path since
11+
# containers-storage: transport can't work when the root fs is read-only
12+
# (composefs), and install-outside-container tests run directly on the host.
1113
bootc image copy-to-storage
12-
let target_image = "containers-storage:localhost/bootc"
14+
skopeo copy containers-storage:localhost/bootc oci:/var/tmp/bootc-oci
15+
let target_image = "oci:/var/tmp/bootc-oci"
1316

1417
# setup filesystem
1518
mkdir /var/mnt
@@ -22,9 +25,6 @@ let result = bootc install to-filesystem /var/mnt e>| find "--source-imgref must
2225
assert not equal $result null
2326
umount /var/mnt
2427

25-
# Mask off the bootupd state to reproduce https://github.com/bootc-dev/bootc/issues/1778
26-
# Also it turns out that installation outside of containers dies due to `error: Multiple commit objects found`
27-
# so we mask off /sysroot/ostree
2828
# And using systemd-run here breaks our install_t so we disable SELinux enforcement
2929
setenforce 0
3030

0 commit comments

Comments
 (0)