commit
8a54526d7d
5 changed files with 29 additions and 17 deletions
2
Makefile
2
Makefile
|
|
@ -64,7 +64,7 @@ git-clean:
|
|||
@git clean -d -q -x
|
||||
|
||||
test:
|
||||
PYTHONPATH=hub/. nosetests --with-coverage --cover-package .
|
||||
PYTHONPATH=hub/.:plugins/hub/. nosetests --with-coverage --cover-package .
|
||||
|
||||
subdirs:
|
||||
for d in $(SUBDIRS); do make -C $$d; [ $$? = 0 ] || exit 1; done
|
||||
|
|
|
|||
|
|
@ -568,17 +568,6 @@ def make_task(method,arglist,**opts):
|
|||
koji.plugin.run_callbacks('postTaskStateChange', attribute='state', old=None, new='FREE', info=opts)
|
||||
return task_id
|
||||
|
||||
def mktask(__taskopts,__method,*args,**opts):
|
||||
"""A wrapper around make_task with alternate signature
|
||||
|
||||
Parameters:
|
||||
_taskopts: a dictionary of task options (e.g. priority, ...)
|
||||
_method: the method to be invoked
|
||||
|
||||
All remaining args (incl. optional ones) are passed on to the task.
|
||||
"""
|
||||
return make_task(__method,koji.encode_args(*args,**opts),**__taskopts)
|
||||
|
||||
def eventCondition(event, table=None):
|
||||
"""return the proper WHERE condition to select data at the time specified by event. """
|
||||
if not table:
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ import koji
|
|||
import random
|
||||
import sys
|
||||
|
||||
#XXX - have to import kojihub for mktask
|
||||
#XXX - have to import kojihub for make_task
|
||||
sys.path.insert(0, '/usr/share/koji-hub/')
|
||||
from kojihub import mktask, get_tag, get_all_arches
|
||||
import kojihub
|
||||
|
||||
__all__ = ('runroot',)
|
||||
|
||||
|
|
@ -38,12 +38,12 @@ def runroot(tagInfo, arch, command, channel=None, **opts):
|
|||
|
||||
if arch == 'noarch':
|
||||
#not all arches can generate a proper buildroot for all tags
|
||||
tag = get_tag(tagInfo)
|
||||
tag = kojihub.get_tag(tagInfo)
|
||||
if not tag['arches']:
|
||||
raise koji.GenericError, 'no arches defined for tag %s' % tag['name']
|
||||
|
||||
#get all known arches for the system
|
||||
fullarches = get_all_arches()
|
||||
fullarches = kojihub.get_all_arches()
|
||||
|
||||
tagarches = tag['arches'].split()
|
||||
|
||||
|
|
@ -57,5 +57,6 @@ def runroot(tagInfo, arch, command, channel=None, **opts):
|
|||
% (tagInfo, taskopts['channel'])
|
||||
taskopts['arch'] = koji.canonArch(random.choice(choices))
|
||||
|
||||
return mktask(taskopts,'runroot', tagInfo, arch, command, **opts)
|
||||
args = koji.encode_args(tagInfo, arch, command,**opts)
|
||||
return kojihub.make_task('runroot', args, **taskopts)
|
||||
|
||||
|
|
|
|||
0
tests/test_plugins/__init__.py
Normal file
0
tests/test_plugins/__init__.py
Normal file
22
tests/test_plugins/test_runroot_hub.py
Normal file
22
tests/test_plugins/test_runroot_hub.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import unittest
|
||||
import mock
|
||||
|
||||
import runroot_hub
|
||||
|
||||
|
||||
class TestRunrootHub(unittest.TestCase):
|
||||
@mock.patch('kojihub.make_task')
|
||||
@mock.patch('runroot_hub.context')
|
||||
def test_basic_invocation(self, context, make_task):
|
||||
runroot_hub.runroot(
|
||||
tagInfo='some_tag',
|
||||
arch='x86_64',
|
||||
command='ls',
|
||||
)
|
||||
make_task.assert_called_once_with(
|
||||
'runroot',
|
||||
('some_tag', 'x86_64', 'ls'),
|
||||
priority=15,
|
||||
arch='x86_64',
|
||||
channel='runroot',
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue