Skip to content

test: close filesystem/disk customization coverage gaps with osbuild-composer - #2329

Merged
supakeen merged 3 commits into
osbuild:mainfrom
ochosi:composer-fs-tests
May 14, 2026
Merged

supakeen merged 3 commits into
osbuild:mainfrom
ochosi:composer-fs-tests

Conversation

@ochosi

@ochosi ochosi commented May 11, 2026

Copy link
Copy Markdown
Contributor

Summary

The osbuild-composer repository has integration tests for filesystem and disk customizations (filesystem.sh, regression-no-explicit-rootfs-definition.sh) that verify partitioning layouts, forbidden mount paths, and edge cases. This PR brings equivalent coverage to the images repository so tests are not lost as functionality migrates.

Changes

  1. check-host-config: add filesystem mountpoint verification
    Add a new filesystem check to check-host-config that verifies all expected mountpoints from both customizations.filesystem and customizations.disk (plain, LVM, btrfs) are present in the booted VM by reading /proc/mounts and /proc/swaps. Previously, builds were verified to boot but never asserted the requested partition layout actually appeared.

  2. test: add filesystem-customizations integration config
    Add a filesystem-customizations.json test config exercising the full set of 16 mountpoints from osbuild-composer's filesystem.sh (/, /var, /var/log, /var/log/audit, /usr, /tmp, /var/tmp, /home, /home/shadowman, /opt, /srv, /app, /data, /boot, /boot/firmware, /foobar).

  3. pkg/policies: add mountpoint policy tests for forbidden and allowed paths
    Add explicit unit tests verifying CheckMountpointsPolicy rejects all 14 forbidden paths (/etc, /sys, /proc, /dev, /run, /bin, /sbin, /lib, /lib64, /lost+found, /sysroot, /usr/bin, /var/run, /var/lock) and accepts the full valid set. This is the images-equivalent of the negative test in osbuild-composer's filesystem.sh.

  4. test: add filesystem-no-explicit-rootfs regression config
    Add a filesystem-no-explicit-rootfs.json config that specifies /data without an explicit / entry, covering the RHBZ#2049500 regression where such composes would fail. The build must succeed with the default root filesystem implicitly created.

Test plan

  • go test ./cmd/check-host-config/check/ -run TestFilesystem — all 7 subtests pass
  • go test ./pkg/policies/ -run TestCheckMountpointsPolicy — all 30 subtests pass
  • python3 test/scripts/validate-config-list — both new configs validated against known build configurations

@achilleas-k achilleas-k left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Love to see more stuff being moved from osbuild-composer down into images again.
Needs some changes though (the image type names in the config at least). Comments inline.

Comment on lines +71 to +76
for _, line := range strings.Split(string(data), "\n") {
fields := strings.Fields(line)
if len(fields) >= 2 {
mounts[fields[1]] = true
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parsing /proc/mounts isn't very nice. It's not likely the format will change any time soon, but lsblk -J is a machine-readable alternative, so let's use that instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very true, amended!

Comment thread test/config-list.json Outdated
Comment on lines +603 to +612
"image-types": [
"generic-qcow2",
"server-qcow2"
],
"distros": [
"centos-10",
"centos-9",
"fedora*",
"rhel-10*",
"rhel-9*"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generic-qcow2 and server-qcow2 are the Fedora image type names. CentOS and RHEL should be move to the next item alongside RHEL 8.

Comment thread pkg/policies/policies_test.go Outdated
// TestCheckMountpointsPolicyForbiddenPaths verifies that a blueprint containing
// forbidden mountpoints (the same set tested in osbuild-composer's filesystem.sh
// fail case) is properly rejected by CheckMountpointsPolicy.
func TestCheckMountpointsPolicyForbiddenPaths(t *testing.T) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be duplicating the tests above in the same file only going through the blueprint method rather than directly calling the policies method. I'm not sure how useful it is. Perhaps having a generic test in the blueprint library would be good, one that sets an arbitrary policy and test if it works as expected.

Comment thread test/config-list.json Outdated
Comment on lines +633 to +643
"image-types": [
"generic-qcow2",
"server-qcow2"
],
"distros": [
"centos-10",
"centos-9",
"fedora*",
"rhel-10*",
"rhel-9*"
]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

@ochosi
ochosi force-pushed the composer-fs-tests branch from 1fa3ad5 to 68bc072 Compare May 11, 2026 15:05
@ochosi
ochosi requested a review from achilleas-k May 11, 2026 15:06
@ochosi
ochosi force-pushed the composer-fs-tests branch 2 times, most recently from b66e424 to dcbb901 Compare May 13, 2026 10:58
ochosi added a commit to ochosi/osbuild-composer that referenced this pull request May 13, 2026
These tests have been ported to the images repository where they now run
as part of the config-driven integration test framework with post-boot
verification via check-host-config. The equivalent coverage is provided
by:

- filesystem-customizations.json (legacy customizations.filesystem API)
- filesystem-no-explicit-rootfs.json (RHBZ#2049500 regression)
- check-host-config filesystem check (mountpoint verification)
- pkg/policies unit tests (forbidden mountpoint rejection)

See: osbuild/image-builder#2329
ochosi added 3 commits May 13, 2026 14:14
Add a new "filesystem" check to check-host-config that verifies expected
mountpoints from the build config are present in the booted image.

It collects all mountpoints from both customizations.filesystem (legacy
API) and customizations.disk (plain partitions, LVM logical volumes,
btrfs subvolumes), then runs lsblk to verify they exist.

This closes a verification gap where partitioning configs only checked
that the image builds and boots, but never asserted that the requested
partitions, LVs, or subvolumes actually appeared.
Add a test configuration that exercises the full set of legacy
customizations.filesystem mountpoints (/, /var, /var/log, /var/log/audit,
/usr, /tmp, /var/tmp, /home, /home/shadowman, /opt, /srv, /app, /data,
/boot, /boot/firmware, /foobar).

This brings coverage parity with osbuild-composer's filesystem.sh test
for the legacy filesystem customization API.
Add a config that specifies customizations.filesystem for /data but
omits an explicit / entry. This covers the RHBZ#2049500 regression where
a compose without an explicit root filesystem definition would fail.

The build is expected to succeed with the default root filesystem
implicitly created by the image builder.
@achilleas-k

achilleas-k commented May 13, 2026 •

Copy link
Copy Markdown
Member

I noticed that the changes addressing my comments were squashed into the last commit instead of fixing up the relevant ones so I cleaned up the history a bit and force pushed.
In the process I also realised we don't need to separate out the RHEL 8 cases in the config-list, so I merged those too.

I also added manifest checksums for the new configurations. Unfortunately, our manifest checksum check doesn't fail when there are missing checksums, only when there are changes that weren't committed.

@achilleas-k

Copy link
Copy Markdown
Member

200 new configs is a bit much though. Maybe we don't need to test all distros here. (but maybe let's let this one build and merge and we can trim things down later)

ochosi added a commit to ochosi/osbuild-composer that referenced this pull request May 13, 2026
These tests have been ported to the images repository where they now run
as part of the config-driven integration test framework with post-boot
verification via check-host-config. The equivalent coverage is provided
by:

- filesystem-customizations.json (legacy customizations.filesystem API)
- filesystem-no-explicit-rootfs.json (RHBZ#2049500 regression)
- check-host-config filesystem check (mountpoint verification)
- pkg/policies unit tests (forbidden mountpoint rejection)

See: osbuild/image-builder#2329
achilleas-k pushed a commit to ochosi/osbuild-composer that referenced this pull request May 14, 2026
These tests have been ported to the images repository where they now run
as part of the config-driven integration test framework with post-boot
verification via check-host-config. The equivalent coverage is provided
by:

- filesystem-customizations.json (legacy customizations.filesystem API)
- filesystem-no-explicit-rootfs.json (RHBZ#2049500 regression)
- check-host-config filesystem check (mountpoint verification)
- pkg/policies unit tests (forbidden mountpoint rejection)

See: osbuild/image-builder#2329

@supakeen supakeen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Building 200 extra images every time we refresh snapshots or osbuild commit is going to be ... fun. Like @achilleas-k says, it's probably pretty high priority to cut that down but let's see if it actually makes CI slow first.

@supakeen
supakeen added this pull request to the merge queue May 14, 2026

@lzap lzap left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm why don't we merge some image configs together?

Merged via the queue into osbuild:main with commit 1c62072 May 14, 2026
20 checks passed
achilleas-k pushed a commit to ochosi/osbuild-composer that referenced this pull request May 14, 2026
These tests have been ported to the images repository where they now run
as part of the config-driven integration test framework with post-boot
verification via check-host-config. The equivalent coverage is provided
by:

- filesystem-customizations.json (legacy customizations.filesystem API)
- filesystem-no-explicit-rootfs.json (RHBZ#2049500 regression)
- check-host-config filesystem check (mountpoint verification)
- pkg/policies unit tests (forbidden mountpoint rejection)

See: osbuild/image-builder#2329
ochosi added a commit to osbuild/osbuild-composer that referenced this pull request May 15, 2026
These tests have been ported to the images repository where they now run
as part of the config-driven integration test framework with post-boot
verification via check-host-config. The equivalent coverage is provided
by:

- filesystem-customizations.json (legacy customizations.filesystem API)
- filesystem-no-explicit-rootfs.json (RHBZ#2049500 regression)
- check-host-config filesystem check (mountpoint verification)
- pkg/policies unit tests (forbidden mountpoint rejection)

See: osbuild/image-builder#2329
@supakeen

Copy link
Copy Markdown
Member

So we missed this, but this PR did not bump the seed and thus these tests didn't actually get ran on all configs. They are now failing in other PRs as the columns requested in lsblk do not exist in all RHEL version. Notably all RHEL 8 configs that try to run this check:

🔴 filesystem: fail: failed to read active mountpoints: failed to run lsblk: exit status 1 (exit 1, stderr: lsblk: unknown column: MOUNTPOINTS,FSTYPE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants