Do not replace branch names in mmd.components.rpms.ref by the commit hash, use our private mmd.xmd.mbs namespace to store that info.

This commit is contained in:
Jan Kaluza
2017-04-13 08:36:04 +02:00
parent 65950304ca
commit c828f60444
3 changed files with 70 additions and 27 deletions

View File

@@ -85,6 +85,7 @@ class TestUtils(unittest.TestCase):
'4ceea43add2366d8b8c5a622a2fb563b625b9abf',
'fbed359411a1baa08d4a88e0d12d426fbf8f602c',
'76f9d8c8e87eed0aab91034b01d3d5ff6bd5b4cb']
original_refs = ["f25"]
mocked_scm.return_value.get_latest.side_effect = hashes_returned
mmd = modulemd.ModuleMetadata()
with open(path.join(BASE_DIR, '..', 'staged_data', 'testmodule.yaml')) \
@@ -95,9 +96,14 @@ class TestUtils(unittest.TestCase):
'?#620ec77321b2ea7b0d67d82992dda3e1d67055b4')
module_build_service.utils.format_mmd(mmd, scmurl)
# Make sure all the commit hashes were properly set on the RPMs
# Make sure all the commit hashes were properly set in xmd section
# of modulemd.
xmd_pkg_refs = [pkg['ref'] for pkg in mmd.xmd['mbs']['rpms'].values()]
self.assertEqual(set(xmd_pkg_refs), set(hashes_returned))
# Make sure that original refs are not changed.
mmd_pkg_refs = [pkg.ref for pkg in mmd.components.rpms.values()]
self.assertEqual(set(mmd_pkg_refs), set(hashes_returned))
self.assertEqual(set(mmd_pkg_refs), set(original_refs))
self.assertEqual(mmd.buildrequires, {'base-runtime': 'master'})
xmd = {
@@ -108,6 +114,9 @@ class TestUtils(unittest.TestCase):
'ref': '464026abf9cbe10fac1d800972e3229ac4d01975',
'stream': 'master',
'version': '20170404161234'}},
'rpms': {'perl-List-Compare': {'ref': '76f9d8c8e87eed0aab91034b01d3d5ff6bd5b4cb'},
'perl-Tangerine': {'ref': '4ceea43add2366d8b8c5a622a2fb563b625b9abf'},
'tangerine': {'ref': 'fbed359411a1baa08d4a88e0d12d426fbf8f602c'}},
'scmurl': 'git://pkgs.stg.fedoraproject.org/modules/testmodule'
'.git?#620ec77321b2ea7b0d67d82992dda3e1d67055b4',
}
@@ -138,6 +147,9 @@ class TestUtils(unittest.TestCase):
'ref': '464026abf9cbe10fac1d800972e3229ac4d01975',
'stream': 'master',
'version': '20170404161234'}},
'rpms': {'perl-List-Compare': {'ref': '76f9d8c8e87eed0aab91034b01d3d5ff6bd5b4cb'},
'perl-Tangerine': {'ref': '4ceea43add2366d8b8c5a622a2fb563b625b9abf'},
'tangerine': {'ref': 'fbed359411a1baa08d4a88e0d12d426fbf8f602c'}},
'scmurl': None,
}
}
@@ -358,13 +370,15 @@ class TestUtils(unittest.TestCase):
self.assertTrue(str(cm.exception).endswith(' No value provided.'))
@vcr.use_cassette(
path.join(CASSETTES_DIR, 'tests.test_utils.TestUtils.test_format_mmd'))
@patch('module_build_service.scm.SCM')
def test_resubmit(self, mocked_scm):
"""
Tests that the module resubmit reintializes the module state and
component states properly.
"""
MockedSCM(mocked_scm, 'testmodule', 'testmodule-bootstrap.yaml',
MockedSCM(mocked_scm, 'testmodule', 'testmodule.yaml',
'620ec77321b2ea7b0d67d82992dda3e1d67055b4')
with app.app_context():
test_reuse_component_init_data()