mirror of
https://github.com/containers/bootc.git
synced 2026-02-05 06:45:13 +01:00
install: Move /var mount test to TMT to reduce disk usage (#1910)
The "install to-filesystem with separate /var mount" test was causing disk space issues on GitHub Actions runners due to its large disk image requirements (12GB for partitions with LVM). Moving it to a TMT test allows it to run in a dedicated VM where disk space is not as constrained. The test verifies that bootc install to-filesystem correctly handles scenarios where /var is on a separate filesystem, which is a common production setup. Changes: - Remove the test from Rust integration tests (install.rs) - Add new TMT test: test-32-install-to-filesystem-var-mount.sh - Add package requirements (parted, lvm2, dosfstools, e2fsprogs) - Update tests.fmf and integration.fmf with new test entry Assisted-by: Claude Code (Opus 4.5) Signed-off-by: ckyrouac <ckyrouac@redhat.com>
This commit is contained in:
@@ -18,6 +18,11 @@ prepare:
|
||||
- expect
|
||||
- ansible-core
|
||||
- zstd
|
||||
# Required for test-32-install-to-filesystem-var-mount
|
||||
- parted
|
||||
- lvm2
|
||||
- dosfstools
|
||||
- e2fsprogs
|
||||
when: running_env != image_mode
|
||||
- how: shell
|
||||
order: 98
|
||||
@@ -147,4 +152,11 @@ execute:
|
||||
how: fmf
|
||||
test:
|
||||
- /tmt/tests/tests/test-31-switch-to-unified
|
||||
|
||||
/plan-32-install-to-filesystem-var-mount:
|
||||
summary: Test bootc install to-filesystem with separate /var mount
|
||||
discover:
|
||||
how: fmf
|
||||
test:
|
||||
- /tmt/tests/tests/test-32-install-to-filesystem-var-mount
|
||||
# END GENERATED PLANS
|
||||
|
||||
148
tmt/tests/booted/test-install-to-filesystem-var-mount.sh
Normal file
148
tmt/tests/booted/test-install-to-filesystem-var-mount.sh
Normal file
@@ -0,0 +1,148 @@
|
||||
# number: 32
|
||||
# tmt:
|
||||
# summary: Test bootc install to-filesystem with separate /var mount
|
||||
# duration: 30m
|
||||
# require:
|
||||
# - parted
|
||||
# - lvm2
|
||||
# - dosfstools
|
||||
# - e2fsprogs
|
||||
#
|
||||
#!/bin/bash
|
||||
# Test bootc install to-filesystem with a pre-existing /var mount point.
|
||||
# This verifies that bootc correctly handles scenarios where /var is on a
|
||||
# separate filesystem, which is a common production setup for managing
|
||||
# persistent data separately from the OS.
|
||||
|
||||
set -xeuo pipefail
|
||||
|
||||
# Use a generic target image to test skew between the bootc binary doing
|
||||
# the install and the target image
|
||||
TARGET_IMAGE="docker://quay.io/centos-bootc/centos-bootc:stream10"
|
||||
|
||||
echo "Testing bootc install to-filesystem with separate /var mount"
|
||||
|
||||
# Disable SELinux enforcement for the install
|
||||
setenforce 0
|
||||
|
||||
# Enable usr-overlay to allow modifications
|
||||
bootc usr-overlay
|
||||
|
||||
# Install required packages (bootc images are immutable, so we need to install
|
||||
# after usr-overlay is enabled)
|
||||
dnf install -y parted lvm2 dosfstools e2fsprogs
|
||||
|
||||
# Mask off conflicting ostree state
|
||||
if test -d /sysroot/ostree; then
|
||||
mount --bind /usr/share/empty /sysroot/ostree
|
||||
fi
|
||||
rm -vrf /usr/lib/bootupd/updates
|
||||
rm -vrf /usr/lib/bootc/bound-images.d
|
||||
|
||||
# Create a 12GB sparse disk image in /var/tmp (not /tmp which may be tmpfs)
|
||||
DISK_IMG=/var/tmp/disk-var-mount-test.img
|
||||
truncate -s 12G "$DISK_IMG"
|
||||
|
||||
# Setup loop device
|
||||
LOOP_DEV=$(losetup -f --show "$DISK_IMG")
|
||||
echo "Using loop device: $LOOP_DEV"
|
||||
|
||||
# Cleanup function
|
||||
cleanup() {
|
||||
set +e
|
||||
echo "Cleaning up..."
|
||||
umount -R /var/mnt/target 2>/dev/null
|
||||
vgchange -an BL 2>/dev/null
|
||||
vgremove -f BL 2>/dev/null
|
||||
losetup -d "$LOOP_DEV" 2>/dev/null
|
||||
rm -f "$DISK_IMG" 2>/dev/null
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
# Create partition table
|
||||
parted -s "$LOOP_DEV" mklabel gpt
|
||||
# BIOS boot partition (for GRUB on GPT)
|
||||
parted -s "$LOOP_DEV" mkpart primary 1MiB 2MiB
|
||||
parted -s "$LOOP_DEV" set 1 bios_grub on
|
||||
# EFI partition (200 MiB)
|
||||
parted -s "$LOOP_DEV" mkpart primary fat32 2MiB 202MiB
|
||||
parted -s "$LOOP_DEV" set 2 esp on
|
||||
# Boot partition (1 GiB)
|
||||
parted -s "$LOOP_DEV" mkpart primary ext4 202MiB 1226MiB
|
||||
# LVM partition (rest of disk)
|
||||
parted -s "$LOOP_DEV" mkpart primary 1226MiB 100%
|
||||
|
||||
# Reload partition table
|
||||
partprobe "$LOOP_DEV"
|
||||
sleep 2
|
||||
|
||||
# Partition device names
|
||||
EFI_PART="${LOOP_DEV}p2"
|
||||
BOOT_PART="${LOOP_DEV}p3"
|
||||
LVM_PART="${LOOP_DEV}p4"
|
||||
|
||||
# Create filesystems on boot partitions
|
||||
mkfs.vfat -F32 "$EFI_PART"
|
||||
mkfs.ext4 -F "$BOOT_PART"
|
||||
|
||||
# Setup LVM
|
||||
pvcreate "$LVM_PART"
|
||||
vgcreate BL "$LVM_PART"
|
||||
|
||||
# Create logical volumes
|
||||
lvcreate -L 4G -n var02 BL
|
||||
lvcreate -L 5G -n root02 BL
|
||||
|
||||
# Create filesystems on logical volumes
|
||||
mkfs.ext4 -F /dev/BL/var02
|
||||
mkfs.ext4 -F /dev/BL/root02
|
||||
|
||||
# Get UUIDs for bootc install
|
||||
ROOT_UUID=$(blkid -s UUID -o value /dev/BL/root02)
|
||||
BOOT_UUID=$(blkid -s UUID -o value "$EFI_PART")
|
||||
|
||||
# Mount the partitions
|
||||
mkdir -p /var/mnt/target
|
||||
mount /dev/BL/root02 /var/mnt/target
|
||||
mkdir -p /var/mnt/target/boot
|
||||
mount "$BOOT_PART" /var/mnt/target/boot
|
||||
mkdir -p /var/mnt/target/boot/efi
|
||||
mount "$EFI_PART" /var/mnt/target/boot/efi
|
||||
|
||||
# Create EFI directory structure with some files (simulating existing EFI content)
|
||||
mkdir -p /var/mnt/target/boot/efi/EFI/fedora
|
||||
touch /var/mnt/target/boot/efi/EFI/fedora/shimx64.efi
|
||||
touch /var/mnt/target/boot/efi/EFI/fedora/grubx64.efi
|
||||
|
||||
# Critical: Mount /var as a separate partition
|
||||
mkdir -p /var/mnt/target/var
|
||||
mount /dev/BL/var02 /var/mnt/target/var
|
||||
|
||||
echo "Filesystem layout:"
|
||||
mount | grep /var/mnt/target || true
|
||||
df -h /var/mnt/target /var/mnt/target/boot /var/mnt/target/boot/efi /var/mnt/target/var
|
||||
|
||||
# Run bootc install to-filesystem
|
||||
# This should succeed and handle the separate /var mount correctly
|
||||
podman run \
|
||||
--rm --privileged \
|
||||
-v /var/mnt/target:/target \
|
||||
-v /dev:/dev \
|
||||
--pid=host \
|
||||
--security-opt label=type:unconfined_t \
|
||||
"$TARGET_IMAGE" \
|
||||
bootc install to-filesystem \
|
||||
--disable-selinux \
|
||||
--karg=root=UUID="$ROOT_UUID" \
|
||||
--root-mount-spec=UUID="$ROOT_UUID" \
|
||||
--boot-mount-spec=UUID="$BOOT_UUID" \
|
||||
/target
|
||||
|
||||
# Verify the installation succeeded
|
||||
echo "Verifying installation..."
|
||||
test -d /var/mnt/target/ostree
|
||||
test -d /var/mnt/target/ostree/repo
|
||||
# Verify bootloader was installed (grub2 or loader for different configurations)
|
||||
test -d /var/mnt/target/boot/grub2 || test -d /var/mnt/target/boot/loader
|
||||
|
||||
echo "Installation to-filesystem with separate /var mount succeeded!"
|
||||
@@ -79,3 +79,13 @@
|
||||
summary: Onboard to unified storage, build derived image, and switch to it
|
||||
duration: 30m
|
||||
test: nu booted/test-switch-to-unified.nu
|
||||
|
||||
/test-32-install-to-filesystem-var-mount:
|
||||
summary: Test bootc install to-filesystem with separate /var mount
|
||||
duration: 30m
|
||||
require:
|
||||
- parted
|
||||
- lvm2
|
||||
- dosfstools
|
||||
- e2fsprogs
|
||||
test: bash booted/test-install-to-filesystem-var-mount.sh
|
||||
|
||||
Reference in New Issue
Block a user