#1257 fail runroot task on non-existing tag
Merged 3 years ago by mikem. Opened 4 years ago by tkopecek.
tkopecek/koji issue1139  into  master

file modified
+1 -1
@@ -37,9 +37,9 @@ 

  

      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 @@ 

  

  

  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 @@ 

                  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 @@ 

          )

  

          # 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 @@ 

              )

  

          # 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),

rebased onto 37a8fdd

4 years ago

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

4 years ago

Metadata Update from @jcupova:
- Pull-request tagged with: testing-done

4 years ago

@mikem - It is marked as testing-done - ready to merge?

Commit da85023 fixes this pull-request

Pull-Request has been merged by mikem

3 years ago