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 <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2021-09-20 12:43:51 +02:00 committed by Ondřej Budai
parent 95f8bd253b
commit 2d2d9fe7f9
2 changed files with 9 additions and 2 deletions

View file

@ -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": {

View file

@ -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]