Log PDC communications and info for modular composes

Fixes: https://pagure.io/pungi/issue/664
Merges: https://pagure.io/pungi/pull-request/723
Signed-off-by: Dong Wang <dowang@redhat.com>
This commit is contained in:
Dong Wang 2017-08-30 16:21:41 +08:00 committed by Lubomír Sedlář
parent 4ff3190935
commit 463fb961bc
4 changed files with 33 additions and 2 deletions

View file

@ -93,6 +93,7 @@ class TestPopulateGlobalPkgset(helpers.PungiTestCase):
self.compose.DEBUG = False
self.koji_wrapper = mock.Mock()
self.pkgset_path = os.path.join(self.topdir, 'work', 'global', 'pkgset_global.pickle')
self.pdc_module_path = os.path.join(self.topdir, 'work', 'global', 'pdc-module-Server.json')
@mock.patch('six.moves.cPickle.dumps')
@mock.patch('pungi.phases.pkgset.pkgsets.KojiPackageSet')
@ -117,6 +118,27 @@ class TestPopulateGlobalPkgset(helpers.PungiTestCase):
with open(self.pkgset_path) as f:
self.assertEqual(f.read(), 'DATA')
@mock.patch('six.moves.cPickle.dumps')
@mock.patch('pungi.phases.pkgset.pkgsets.KojiPackageSet')
@mock.patch('pungi.phases.pkgset.sources.source_koji.get_module')
@mock.patch('pungi.phases.pkgset.sources.source_koji.get_pdc_client_session')
@mock.patch('pungi.phases.pkgset.sources.source_koji.modulemd')
def test_pdc_log(self, modulemd, get_pdc_client_session, get_module, KojiPackageSet, pickle_dumps):
pickle_dumps.return_value = b'DATA'
get_module.return_value = {'abc': 'def', 'modulemd': 'sth', 'rpms': ['dummy'], 'koji_tag': 'taggg'}
for name, variant in self.compose.variants.items():
variant.get_modules = mock.MagicMock()
if name == 'Server':
variant.get_modules.return_value = [{'name': 'a'}]
source_koji.populate_global_pkgset(
self.compose, self.koji_wrapper, '/prefix', 123456)
with open(self.pdc_module_path, 'r') as pdc_f:
self.assertEqual(json.load(pdc_f),
[{"rpms": ["dummy"], "abc": "def", "koji_tag": "taggg", "modulemd": "sth"}])
@mock.patch('six.moves.cPickle.dumps')
@mock.patch('pungi.phases.pkgset.pkgsets.KojiPackageSet')
def test_populate_with_multiple_koji_tags(self, KojiPackageSet, pickle_dumps):