mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-03 10:48:03 +08:00
Not fail when 'ref' is missing
This commit is contained in:
@@ -767,8 +767,9 @@ def get_reusable_component(session, module, component_name):
|
||||
# Assumes that the streams have been replaced with commit hashes, so we
|
||||
# can compare to see if they have changed. Since a build is unique to
|
||||
# a commit hash, this is a safe test.
|
||||
if br_module['ref'] != \
|
||||
old_mmd.xmd['mbs']['buildrequires'][br_module_name]['ref']:
|
||||
ref1 = br_module.get('ref')
|
||||
ref2 = old_mmd.xmd['mbs']['buildrequires'][br_module_name].get('ref')
|
||||
if not (ref1 and ref2) or ref1 != ref2:
|
||||
return None
|
||||
|
||||
# At this point we've determined that both module builds depend(ed) on the
|
||||
|
||||
@@ -151,6 +151,19 @@ class TestUtils(unittest.TestCase):
|
||||
db.session, new_module, 'tangerine')
|
||||
self.assertEqual(rv.package, 'tangerine')
|
||||
|
||||
def test_get_reusable_component_empty_scmurl(self):
|
||||
test_reuse_component_init_data()
|
||||
|
||||
new_module = models.ModuleBuild.query.filter_by(id=2).one()
|
||||
mmd = new_module.mmd()
|
||||
mmd.xmd['mbs']['buildrequires'] = {'base-runtime': {}}
|
||||
new_module.modulemd = mmd.dumps()
|
||||
db.session.commit()
|
||||
|
||||
rv = module_build_service.utils.get_reusable_component(
|
||||
db.session, new_module, 'tangerine')
|
||||
self.assertEqual(rv, None)
|
||||
|
||||
def test_get_reusable_component_different_perl_tangerine(self):
|
||||
test_reuse_component_init_data()
|
||||
second_module_build = models.ModuleBuild.query.filter_by(id=2).one()
|
||||
|
||||
Reference in New Issue
Block a user