test/builder: test failing composes

Check that an exception is thrown on compose failures, i.e. when
the compose status indicates that the compose has failed.
This commit is contained in:
Christian Kellner 2020-09-18 17:33:24 +02:00
parent f2f34a3b76
commit 825584966e

View file

@ -357,6 +357,33 @@ class TestBuilderPlugin(PluginTest):
have = [r["baseurl"] for r in ir["repositories"]]
self.assertEqual(have, repos)
@httpretty.activate
def test_compose_failure(self):
# Simulate a failed compose, check exception is raised
session = self.mock_session()
options = self.mock_options()
handler = self.plugin.OSBuildImage(1,
"osbuildImage",
"params",
session,
options)
args = ["name", "version", "distro",
["image_type"],
"fedora-candidate",
["x86_64"],
{}]
url = self.plugin.DEFAULT_COMPOSER_URL
composer = MockComposer(url, architectures=["x86_64"])
composer.httpretty_regsiter()
composer.status = "failure"
with self.assertRaises(koji.BuildError):
handler.handler(*args)
@httpretty.activate
def test_cli_compose_success(self):
# Check the basic usage of the plugin as a stand-alone client