From 81389b7fab3921ba76c47e381021b21f5890fdb2 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 18 Jan 2024 17:37:30 +0100 Subject: [PATCH] fixup! add quick outline of how this could be tested --- test/test_build.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/test/test_build.py b/test/test_build.py index 1364fe279..4a6495c48 100644 --- a/test/test_build.py +++ b/test/test_build.py @@ -28,7 +28,7 @@ # image types to test -DIRECT_BOOT_IMAGE_TYPES = ["qcow2", "ami", "raw"] +DIRECT_BOOT_IMAGE_TYPES = ["qcow2,aarch64", "ami", "raw"] INSTALLER_IMAGE_TYPES = ["iso"] SUPPORTED_IMAGE_TYPES = DIRECT_BOOT_IMAGE_TYPES + INSTALLER_IMAGE_TYPES @@ -36,6 +36,7 @@ class ImageBuildResult(NamedTuple): img_type: str img_path: str + img_arch: str username: str password: str journal_output: str @@ -49,7 +50,12 @@ def image_type_fixture(tmpdir_factory, build_container, request, force_aws_uploa ImageBuildResult with the resulting image path and user/password """ # image_type is passed via special pytest parameter fixture - image_type = request.param + image_type_inp = request.param + target_arch = None + if "," in image_type_inp: + image_type, target_arch = image_type_inp.split(",") + else: + image_type = image_type_inp username = "test" password = "password" @@ -64,7 +70,7 @@ def image_type_fixture(tmpdir_factory, build_container, request, force_aws_uploa "raw": pathlib.Path(output_path) / "image/disk.raw", "iso": pathlib.Path(output_path) / "bootiso/install.iso", } - assert len(artifact) == len(SUPPORTED_IMAGE_TYPES), \ + assert len(artifact) == len(set([t.split(",")[0] for t in SUPPORTED_IMAGE_TYPES])), \ "please keep artifact mapping and supported images in sync" generated_img = artifact[image_type] @@ -95,6 +101,8 @@ def image_type_fixture(tmpdir_factory, build_container, request, force_aws_uploa upload_args = [] creds_args = [] + if target_arch: + target_arch_args = ["--target-arch", target_arch] with tempfile.TemporaryDirectory() as tempdir: if image_type == "ami": @@ -124,6 +132,7 @@ def image_type_fixture(tmpdir_factory, build_container, request, force_aws_uploa container_to_build_ref(), "--config", "/output/config.json", "--type", image_type, + *target_arch_args, *upload_args, ]) journal_output = testutil.journal_after_cursor(cursor) @@ -137,7 +146,7 @@ def del_ami(): journal_log_path.write_text(journal_output, encoding="utf8") - return ImageBuildResult(image_type, generated_img, username, password, journal_output, metadata) + return ImageBuildResult(image_type, generated_img, target_arch, username, password, journal_output, metadata) def test_container_builds(build_container):