fail runroot task on non-existing tag
Fixes: https://pagure.io/koji/issue/1139
This commit is contained in:
parent
30a1b6564a
commit
167eba3394
2 changed files with 7 additions and 5 deletions
|
|
@ -37,9 +37,9 @@ def runroot(tagInfo, arch, command, channel=None, **opts):
|
|||
|
||||
taskopts['channel'] = channel or 'runroot'
|
||||
|
||||
tag = kojihub.get_tag(tagInfo, strict=True)
|
||||
if arch == 'noarch':
|
||||
#not all arches can generate a proper buildroot for all tags
|
||||
tag = kojihub.get_tag(tagInfo)
|
||||
if not tag['arches']:
|
||||
raise koji.GenericError('no arches defined for tag %s' % tag['name'])
|
||||
|
||||
|
|
|
|||
|
|
@ -10,10 +10,12 @@ import runroot_hub
|
|||
|
||||
|
||||
class TestRunrootHub(unittest.TestCase):
|
||||
@mock.patch('kojihub.get_tag')
|
||||
@mock.patch('kojihub.make_task')
|
||||
@mock.patch('runroot_hub.context')
|
||||
def test_basic_invocation(self, context, make_task):
|
||||
def test_basic_invocation(self, context, make_task, get_tag):
|
||||
context.session.assertPerm = mock.MagicMock()
|
||||
get_tag.return_value = {'name': 'some_tag', 'arches': ''}
|
||||
runroot_hub.runroot(
|
||||
tagInfo='some_tag',
|
||||
arch='x86_64',
|
||||
|
|
@ -38,7 +40,7 @@ class TestRunrootHub(unittest.TestCase):
|
|||
arch='noarch',
|
||||
command='ls',
|
||||
)
|
||||
get_tag.assert_called_once_with('some_tag')
|
||||
get_tag.assert_called_once_with('some_tag', strict=True)
|
||||
|
||||
@mock.patch('kojihub.make_task')
|
||||
@mock.patch('kojihub.get_all_arches')
|
||||
|
|
@ -84,7 +86,7 @@ class TestRunrootHub(unittest.TestCase):
|
|||
)
|
||||
|
||||
# check results
|
||||
get_tag.assert_called_once_with('some_tag')
|
||||
get_tag.assert_called_once_with('some_tag', strict=True)
|
||||
context.handlers.call.assert_has_calls([
|
||||
mock.call('getChannel', 'runroot', strict=True),
|
||||
mock.call('listHosts', channelID=2, enabled=True),
|
||||
|
|
@ -142,7 +144,7 @@ class TestRunrootHub(unittest.TestCase):
|
|||
)
|
||||
|
||||
# check results
|
||||
get_tag.assert_called_once_with('some_tag')
|
||||
get_tag.assert_called_once_with('some_tag', strict=True)
|
||||
context.handlers.call.assert_has_calls([
|
||||
mock.call('getChannel', 'runroot', strict=True),
|
||||
mock.call('listHosts', channelID=2, enabled=True),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue