From dd7fa809abc3081713008653c87d3722a0277387 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Tue, 13 Aug 2024 21:20:47 +0200 Subject: [PATCH] test: manifest test for filesystem customizations (cross-arch) Add the same test as in the previous commit but for cross-arch manifests. Cross-arch builds only support ext4 filesystems. Any selected root fstype (whether from the container itself or from the --rootfs option) is ignored (with a warning) --- test/test_manifest.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/test_manifest.py b/test/test_manifest.py index b0fd52a3..13a6c3af 100644 --- a/test/test_manifest.py +++ b/test/test_manifest.py @@ -461,3 +461,36 @@ def assert_fs_customizations(customizations, fstype, manifest): # check that all fs customizations appear in fstab for custom_mountpoint in customizations: assert custom_mountpoint in manifest_mountpoints + + +@pytest.mark.skipif(platform.uname().machine != "x86_64", reason="cross arch test only runs on x86") +@pytest.mark.parametrize("fscustomizations,rootfs", [ + ({"/var/data": "2 GiB", "/var/stuff": "10 GiB"}, "xfs"), + ({"/var/data": "2 GiB", "/var/stuff": "10 GiB"}, "ext4"), + ({"/": "2 GiB", "/boot": "1 GiB"}, "ext4"), + ({"/": "2 GiB", "/boot": "1 GiB", "/var/data": "42 GiB"}, "ext4"), + ({"/": "2 GiB"}, "btrfs"), +]) +def test_manifest_fs_customizations_xarch(tmp_path, build_container, fscustomizations, rootfs): + container_ref = "quay.io/centos-bootc/centos-bootc:stream9" + + config = { + "customizations": { + "filesystem": [{"mountpoint": mnt, "minsize": minsize} for mnt, minsize in fscustomizations.items()], + }, + } + config_path = tmp_path / "config.json" + with config_path.open("w") as config_file: + json.dump(config, config_file) + output = subprocess.check_output([ + *testutil.podman_run_common, + "-v", f"{config_path}:/config.json:ro", + "--entrypoint=/usr/bin/bootc-image-builder", + build_container, + f"--rootfs={rootfs}", + "--target-arch=aarch64", + "manifest", f"{container_ref}", + ]) + + # cross-arch builds only support ext4 (for now) + assert_fs_customizations(fscustomizations, "ext4", output)