mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-13 16:59:52 +08:00
Tests: separate starting and watching the builds
This makes the tests more explicit, but also prepares the ground to enable canceling test builds during session teardown in the future. Signed-off-by: Hunor Csomortáni <csomh@redhat.com>
This commit is contained in:
@@ -16,12 +16,11 @@ def test_failed_build(test_env, repo, koji):
|
||||
build = utils.Build(test_env["packaging_utility"], test_env["mbs_api"])
|
||||
repo.bump()
|
||||
build.run(
|
||||
"--watch",
|
||||
"--scratch",
|
||||
"--optional",
|
||||
"rebuild_strategy=all",
|
||||
reuse=test_env["testdata"]["failed_build"].get("build_id"),
|
||||
)
|
||||
build.watch()
|
||||
|
||||
assert build.state_name == "failed"
|
||||
batch = test_env["testdata"]["failed_build"]["batch"]
|
||||
|
||||
@@ -20,12 +20,12 @@ def test_normal_build(test_env, repo, koji):
|
||||
build = utils.Build(test_env["packaging_utility"], test_env["mbs_api"])
|
||||
repo.bump()
|
||||
build_id = build.run(
|
||||
"--watch",
|
||||
"--scratch",
|
||||
"--optional",
|
||||
"rebuild_strategy=all",
|
||||
reuse=test_env["testdata"]["normal_build"].get("build_id"),
|
||||
)
|
||||
build.watch()
|
||||
|
||||
assert sorted(build.component_names()) == sorted(repo.components + ["module-build-macros"])
|
||||
|
||||
expected_buildorder = test_env["testdata"]["normal_build"]["buildorder"]
|
||||
|
||||
@@ -16,12 +16,12 @@ def test_scratch_build(test_env, repo, koji):
|
||||
"""
|
||||
build = utils.Build(test_env["packaging_utility"], test_env["mbs_api"])
|
||||
build.run(
|
||||
"--watch",
|
||||
"--scratch",
|
||||
"--optional",
|
||||
"rebuild_strategy=all",
|
||||
reuse=test_env["testdata"]["scratch_build"].get("build_id"),
|
||||
)
|
||||
build.watch()
|
||||
|
||||
assert build.state_name == "done"
|
||||
assert sorted(build.component_names(state="COMPLETE")) == sorted(
|
||||
|
||||
@@ -154,6 +154,17 @@ class Build:
|
||||
self._build_id = int(re.search(self._mbs_api + r"module-builds/(\d+)", stdout).group(1))
|
||||
return self._build_id
|
||||
|
||||
def watch(self):
|
||||
"""Watch the build till the finish"""
|
||||
if self._build_id is None:
|
||||
raise RuntimeError("Build was not started. Cannot watch.")
|
||||
|
||||
stdout = self._packaging_utility(
|
||||
"module-build-watch", str(self._build_id)
|
||||
).stdout.decode("utf-8")
|
||||
|
||||
return stdout
|
||||
|
||||
def cancel(self):
|
||||
"""Cancel the module build
|
||||
|
||||
|
||||
Reference in New Issue
Block a user