mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-04 03:08:21 +08:00
Fake repo.done message without publishing it
This commit is contained in:
@@ -1058,7 +1058,18 @@ class CoprModuleBuilder(GenericBuilder):
|
||||
# This forces install of bash into buildroot and srpm-buildroot
|
||||
koji add-group-pkg $module-build-tag srpm-build bash
|
||||
"""
|
||||
pass
|
||||
|
||||
# Start of a new batch of builds is triggered by buildsys.repo.done message.
|
||||
# However in Copr there is no such thing. Therefore we are going to fake
|
||||
# the message when builds are finished
|
||||
self._send_repo_done()
|
||||
|
||||
def _send_repo_done(self):
|
||||
msg = module_build_service.messaging.KojiRepoChange(
|
||||
msg_id='a faked internal message',
|
||||
repo_tag=self.tag_name + "-build",
|
||||
)
|
||||
module_build_service.scheduler.consumer.work_queue_put(msg)
|
||||
|
||||
def buildroot_add_repos(self, dependencies):
|
||||
log.info("%r adding deps on %r" % (self, dependencies))
|
||||
|
||||
@@ -304,18 +304,6 @@ class CoprBuildEnd(KojiBuildChange):
|
||||
self.copr = copr
|
||||
|
||||
|
||||
class CoprRepoDone(object):
|
||||
"""There is actually no repo.done message in Copr
|
||||
This is a class for constructing buildsys.repo.done
|
||||
and triggering it locally"""
|
||||
def __init__(self, copr):
|
||||
self.copr = copr
|
||||
|
||||
def publish(self):
|
||||
msg = {"tag": "{}-build".format(self.copr)}
|
||||
publish("repo.done", msg, conf, "buildsys")
|
||||
|
||||
|
||||
class MBSModule(BaseMessage):
|
||||
""" A class that inherits from BaseMessage to provide a message
|
||||
object for a module event generated by module_build_service
|
||||
|
||||
@@ -30,7 +30,7 @@ import module_build_service.pdc
|
||||
|
||||
import koji
|
||||
|
||||
from module_build_service import models, log, messaging
|
||||
from module_build_service import models, log
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
@@ -111,13 +111,6 @@ def _finalize(config, session, msg, state):
|
||||
builder.tag_artifacts(built_components_in_batch)
|
||||
|
||||
session.commit()
|
||||
|
||||
# Start of new batch is triggered by buildys.repo.done message.
|
||||
# However in Copr there is no such thing. Therefore,
|
||||
# since the batch is done, we can state that repo is done
|
||||
if config.system == "copr":
|
||||
messaging.CoprRepoDone(msg.copr).publish()
|
||||
|
||||
elif (any([c.state != koji.BUILD_STATES['BUILDING']
|
||||
for c in unbuilt_components_in_batch])):
|
||||
# We are not in the middle of the batch building and
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
import unittest
|
||||
from module_build_service import messaging, conf
|
||||
from mock import patch, PropertyMock, ANY
|
||||
from mock import patch, PropertyMock
|
||||
|
||||
|
||||
class TestFedmsgMessaging(unittest.TestCase):
|
||||
@@ -90,10 +90,3 @@ class TestFedmsgMessaging(unittest.TestCase):
|
||||
self.assertEqual(msg.build_release, '1.20150203.git.c8504a8a.fc21')
|
||||
self.assertEqual(msg.state_reason,
|
||||
'build end: user:fatka copr:mutt-kz build:100 ip:172.16.3.3 pid:12010 status:1')
|
||||
|
||||
@patch("module_build_service.messaging.publish")
|
||||
def test_copr_repo_done(self, publish):
|
||||
messaging.CoprRepoDone('someprojectname').publish()
|
||||
self.assertTrue(publish.called)
|
||||
repo_change_msg = {'tag': 'someprojectname-build'}
|
||||
publish.assert_called_with("repo.done", repo_change_msg, ANY, "buildsys")
|
||||
|
||||
Reference in New Issue
Block a user