From a8758c7316848f9832df3f18a77eff6b38602fd5 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Jan 23 2018 23:07:27 +0000 Subject: Fix this damn UnsupportedComposeError path for the third time ...with a test this time. Sigh. It really works now! Promise! Signed-off-by: Adam Williamson --- diff --git a/fedora_openqa/schedule.py b/fedora_openqa/schedule.py index d7bf413..af678c1 100644 --- a/fedora_openqa/schedule.py +++ b/fedora_openqa/schedule.py @@ -254,9 +254,10 @@ def jobs_from_compose(location, wanted=None, force=False, extraparams=None, open # didn't match the URL we requested: this is bad raise TriggerException(str(err)) except UnsupportedComposeError: - # this is fine, we don't need to warn, just return + # this is fine, we don't need to warn, just return empty + # values logger.debug("Ignoring unsupported compose at %s", location) - return (rel.cid, []) + return ('', []) logger.debug("Finding images for compose %s in location %s", rel.cid, location) images = _get_images(rel, wanted=wanted) if len(images) == 0: diff --git a/tests/test_schedule.py b/tests/test_schedule.py index b8dd9c5..3e00943 100644 --- a/tests/test_schedule.py +++ b/tests/test_schedule.py @@ -384,6 +384,13 @@ def test_jobs_from_compose_tag(fakeclient, fakerun, ffmock02): assert reqargs[0] == ('POST', 'groups/1/comments') assert reqargs[1]['params'] == {'text': 'tag:Fedora-25-20161115.n.0:important:candidate'} +def test_jobs_from_compose_unsupported(): + """Check that we create no jobs for composes fedfind explicitly + tells us it does not support (by raising UnsupportedComposeError). + """ + ret = schedule.jobs_from_compose('https://kojipkgs.fedoraproject.org/compose/updates/Fedora-27-updates-testing-20180123.0/compose/') + assert ret == ('', []) + @mock.patch('fedfind.helpers.get_current_release', return_value=25) @mock.patch('fedora_openqa.schedule.OpenQA_Client', autospec=True) def test_jobs_from_update(fakeclient, fakecurr):