Files
fm-orchestrator/tests/integration/test_resume_cancelled_build.py
Mariana Ulaieva a5f6d8f136 Factor out packaging utility
Until now, it was assumed that the module-build command returned only
one build, so it was only one build_id. However, it is possible that
the module-build command will build more than one builds and therefore
a list of build_ids is needed. Also is needed to watch and cancel more
than one build.
For this reason run, watch, and cancel methods are methods of the
PackagingUtility class instead of Build class.  Run method returns list
of Build objects instead of build_id. And it's also possible to cancel
and to watch on all generated module builds.
2020-01-23 14:26:46 +01:00

36 lines
994 B
Python

# -*- coding: utf-8 -*-
# SPDX-License-Identifier: MIT
import time
def test_resume_cancelled_build(pkg_util, scenario, repo, koji):
"""
Run the build with "rebuild_strategy=all".
Wait until the module-build-macros build is submitted to Koji.
Cancel module build.
Resume the module with "rhpkg-stage module-build -w".
Check that:
* Check that the testmodule had actually been cancelled
* Check that the testmodule build succeeded
"""
repo.bump()
builds = pkg_util.run(
"--optional",
"rebuild_strategy=all",
)
assert len(builds) == 1
build = builds[0]
build.wait_for_koji_task_id(package="module-build-macros", batch=1)
pkg_util.cancel(build)
# Behave like a human: restarting the build too quickly would lead to an error.
time.sleep(10)
builds = pkg_util.run("--watch")
assert len(builds) == 1
build = builds[0]
assert build.state_name == "ready"
assert build.was_cancelled()