Files
fm-orchestrator/tests/integration/test_normal_build.py
Hunor Csomortáni 5f7442f8c1 Tests: Create a fixture for scenario configuration
Until now, to access the configuration of a scenario, the full path in
test_env had to be specified.

This might be cumbersome and error prone.

Create a scenario fixture, to make it easier to access the same
configuration.

Instead of

    test_env["testdata"]["my_scenario"]["my_config"]

one can use the following:

    scenario["my_config"]

Signed-off-by: Hunor Csomortáni <csomh@redhat.com>
2020-01-16 10:29:14 +01:00

48 lines
1.7 KiB
Python

# -*- coding: utf-8 -*-
# SPDX-License-Identifier: MIT
import utils
def test_normal_build(test_env, scenario, repo, koji):
"""
Run build with `rhpkg-stage module-build --optional rebuild_strategy=all`
Checks:
* Check that MBS will submit all the component builds
* Check that buildorder of components is respected
* Check that MBS will create two content generator builds representing the module:
- [module]
- [module]-devel
* Check that MBS changed the buildrequired platform to have a suffix of “z”
if a Platform stream is representing a GA RHEL release.
"""
build = utils.Build(test_env["packaging_utility"], test_env["mbs_api"])
repo.bump()
build_id = build.run(
"--optional",
"rebuild_strategy=all",
reuse=scenario.get("build_id"),
)
build.watch()
assert sorted(build.component_names()) == sorted(repo.components + ["module-build-macros"])
expected_buildorder = scenario["buildorder"]
expected_buildorder = [set(batch) for batch in expected_buildorder]
actual_buildorder = build.batches()
assert actual_buildorder == expected_buildorder
cg_build = koji.get_build(build.nvr())
cg_devel_build = koji.get_build(build.nvr(name_suffix="-devel"))
assert cg_build and cg_devel_build
assert cg_devel_build['extra']['typeinfo']['module']['module_build_service_id'] == int(build_id)
modulemd = koji.get_modulemd(cg_build)
actual_platforms = modulemd["data"]["dependencies"][0]["buildrequires"]["platform"]
expected_platforms = repo.platform
platform_ga = scenario.get("platform_is_ga")
if platform_ga:
expected_platforms = [f"{pf}.z" for pf in expected_platforms]
assert expected_platforms == actual_platforms