generate-all-test-cases: add manifests command
Add `manifests` command for generating image test cases without `image-info` report, so only manifests. Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
parent
01864e4db7
commit
8ee90334ba
1 changed files with 59 additions and 0 deletions
|
|
@ -1259,6 +1259,65 @@ class RemoteTestCaseMatrixGenerator(BaseTestCaseMatrixGenerator):
|
|||
generator.generate()
|
||||
|
||||
|
||||
@register_generator_cls
|
||||
class ManifestTestCaseMatrixGenerator(BaseTestCaseMatrixGenerator):
|
||||
"""
|
||||
Class representing generation of all test case manifests based on provided test
|
||||
cases matrix locally.
|
||||
"""
|
||||
|
||||
arch_runner_map = {
|
||||
"x86_64": True,
|
||||
"aarch64": True,
|
||||
"ppc64le": True,
|
||||
"s390x": True
|
||||
}
|
||||
|
||||
def __init__(self, arch_gen_matrix, sources, output, repos, keep_workdir, log_level=logging.INFO):
|
||||
"""
|
||||
Constructor
|
||||
"""
|
||||
super().__init__(arch_gen_matrix=arch_gen_matrix, sources=sources, output=output, ssh_id_file="/dev/null",
|
||||
repos=repos, build_rpms=False, keep_workdir=keep_workdir, log_level=log_level)
|
||||
|
||||
def generate(self):
|
||||
"""
|
||||
Generates all test cases based on provided data in a blocking manner.
|
||||
"""
|
||||
for arch_name, distros in self.arch_gen_matrix.items():
|
||||
for distro_name, image_types in distros.items():
|
||||
for image_type in image_types:
|
||||
script_dir = os.path.dirname(__file__)
|
||||
log.info("Generating manifest for %s-%s-%s", distro_name, arch_name, image_type)
|
||||
try:
|
||||
subprocess.check_call([f"{script_dir}/generate-test-cases", "--distro", f"{distro_name}", "--arch",
|
||||
f"{arch_name}", "--image-types", f"{image_type}", "--store", "/dev/null", "--output", f"{self.output}",
|
||||
"--keep-image-info"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
except subprocess.CalledProcessError as e:
|
||||
log.error("Generating manifest for %s-%s-%s FAILED: %s", distro_name, arch_name, image_type, e)
|
||||
|
||||
@staticmethod
|
||||
def add_subparser(subparsers):
|
||||
"""
|
||||
Adds subparser for the 'manifests' command
|
||||
"""
|
||||
parser_remote = subparsers.add_parser(
|
||||
"manifests",
|
||||
description="locally generate test case manifests only",
|
||||
help="locally generate test case manifests only"
|
||||
)
|
||||
parser_remote.set_defaults(func=ManifestTestCaseMatrixGenerator.main)
|
||||
|
||||
@staticmethod
|
||||
def main(arch_gen_matrix_dict, sources, output, ssh_id_file, repos, build_rpms, keep_workdir, parser_args):
|
||||
"""
|
||||
The main function of the 'manifests' command
|
||||
"""
|
||||
with ManifestTestCaseMatrixGenerator(
|
||||
arch_gen_matrix_dict, sources, output, repos, log.level) as generator:
|
||||
generator.generate()
|
||||
|
||||
|
||||
def get_default_ssh_id_file():
|
||||
"""
|
||||
Returns the path of the default SSH ID file to use.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue