From 2d2d9fe7f93bbf66335fbf81347e6718ffecda0a Mon Sep 17 00:00:00 2001 From: Tomas Hozza Date: Mon, 20 Sep 2021 12:43:51 +0200 Subject: [PATCH] generate-test-cases: check `supported_arches` from format-request-map.json Some image type test cases require additional repositories, which are not available for all architectures. However, when an image type test case is specified in the `format-request-map.json`, it is generated on any architecture. This behavior is creating issues when generating `*edge-commit` image type test cases. This is because the `format-request-map.json` contains one additional definition for `*edge-commit-rt`, which includes `kernel-rt` package. However repositories with this package are available only for x86_64. Therefore, when generating image test cases for `*edge-commit`, the `generate-test-cases` script always generates two test cases, but the generation of `*edge-commit-rt` always fails on non-x86_64 architectures. Add a new optional member to the image type test case object in `format-request-map.json`, called `supported_arches`. Its value is a list of strings, specifying the supported architectures of the image type test case. In case the member is not specified, the image test case is supported on any architecture. Extend the `generate-test-cases` script to skip image type test case generation in case the case has the `supported_arches` specified and the requested architecture is not in the list. Fix #1478 Signed-off-by: Tomas Hozza --- tools/test-case-generators/format-request-map.json | 6 ++++-- tools/test-case-generators/generate-test-cases | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/test-case-generators/format-request-map.json b/tools/test-case-generators/format-request-map.json index 33804e362..709b07527 100644 --- a/tools/test-case-generators/format-request-map.json +++ b/tools/test-case-generators/format-request-map.json @@ -69,7 +69,8 @@ } } }, - "overrides": {} + "overrides": {}, + "supported_arches": ["x86_64"] }, "rhel-edge-commit": { "compose-request": { @@ -108,7 +109,8 @@ } } }, - "overrides": {} + "overrides": {}, + "supported_arches": ["x86_64"] }, "fedora-iot-commit": { "compose-request": { diff --git a/tools/test-case-generators/generate-test-cases b/tools/test-case-generators/generate-test-cases index dd1e41af8..85f069250 100755 --- a/tools/test-case-generators/generate-test-cases +++ b/tools/test-case-generators/generate-test-cases @@ -242,6 +242,11 @@ def main(distro, arch, image_types, keep_image_info, store, output, with_customi if filtered_request["compose-request"]["image-type"] not in image_types: continue filtered_request["compose-request"]["distro"] = distro + # if the compose-request has specified supported arches, then generate + # the test case only if the requested arch is in the list + supported_arches = filtered_request.get("supported_arches") + if supported_arches is not None and arch not in supported_arches: + continue filtered_request["compose-request"]["arch"] = arch filtered_request["compose-request"]["repositories"] = repos_dict[distro][arch]