Files
fm-orchestrator/tests/integration/test_failed_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

34 lines
1.0 KiB
Python

# -*- coding: utf-8 -*-
# SPDX-License-Identifier: MIT
import utils
def test_failed_build(test_env, scenario, repo, koji):
"""
Run the build with "rebuild_strategy=all".
Check that:
* Check that the module build eventually fails
* Check that any other components in the same batch as the failed component are
cancelled, if not completed.
"""
build = utils.Build(test_env["packaging_utility"], test_env["mbs_api"])
repo.bump()
build.run(
"--optional",
"rebuild_strategy=all",
reuse=scenario.get("build_id"),
)
build.watch()
assert build.state_name == "failed"
batch = scenario["batch"]
failing_components = scenario["failing_components"]
canceled_components = scenario["canceled_components"]
assert sorted(failing_components) == sorted(build.component_names(state="FAILED", batch=batch))
assert sorted(canceled_components) == sorted(
build.component_names(state="COMPLETE", batch=batch)
+ build.component_names(state="CANCELED", batch=batch)
)