diff --git a/module_build_service/utils.py b/module_build_service/utils.py index a64e6f07..7f3e35bc 100644 --- a/module_build_service/utils.py +++ b/module_build_service/utils.py @@ -1401,7 +1401,11 @@ def get_rpm_release(module_build): dist_str = '.'.join([module_build.name, module_build.stream, str(module_build.version), str(module_build.context)]) dist_hash = hashlib.sha1(dist_str).hexdigest()[:8] - return conf.default_dist_tag_prefix + dist_hash + return "{prefix}{index}+{dist_hash}".format( + prefix=conf.default_dist_tag_prefix, + index=module_build.id or 0, + dist_hash=dist_hash, + ) def create_dogpile_key_generator_func(skip_first_n_args=0): diff --git a/tests/test_build/test_build.py b/tests/test_build/test_build.py index 58dc3350..c5261757 100644 --- a/tests/test_build/test_build.py +++ b/tests/test_build/test_build.py @@ -780,9 +780,9 @@ class TestBuild(unittest.TestCase): # Check that components are tagged after the batch is built. tag_groups = [] tag_groups.append(set( - ['perl-Tangerine-0.23-1.module+814cfa39', - 'perl-List-Compare-0.53-5.module+814cfa39', - 'tangerine-0.22-3.module+814cfa39'])) + ['perl-Tangerine-0.23-1.module+0+814cfa39', + 'perl-List-Compare-0.53-5.module+0+814cfa39', + 'tangerine-0.22-3.module+0+814cfa39'])) def on_tag_artifacts_cb(cls, artifacts, dest_tag=True): if dest_tag is True: @@ -791,9 +791,9 @@ class TestBuild(unittest.TestCase): buildtag_groups = [] buildtag_groups.append(set( - ['perl-Tangerine-0.23-1.module+814cfa39', - 'perl-List-Compare-0.53-5.module+814cfa39', - 'tangerine-0.22-3.module+814cfa39'])) + ['perl-Tangerine-0.23-1.module+0+814cfa39', + 'perl-List-Compare-0.53-5.module+0+814cfa39', + 'tangerine-0.22-3.module+0+814cfa39'])) def on_buildroot_add_artifacts_cb(cls, artifacts, install): self.assertEqual(buildtag_groups.pop(0), set(artifacts)) @@ -840,9 +840,9 @@ class TestBuild(unittest.TestCase): # Check that components are tagged after the batch is built. tag_groups = [] tag_groups.append(set( - ['perl-Tangerine-0.23-1.module+814cfa39', - 'perl-List-Compare-0.53-5.module+814cfa39', - 'tangerine-0.22-3.module+814cfa39'])) + ['perl-Tangerine-0.23-1.module+0+814cfa39', + 'perl-List-Compare-0.53-5.module+0+814cfa39', + 'tangerine-0.22-3.module+0+814cfa39'])) def on_tag_artifacts_cb(cls, artifacts, dest_tag=True): if dest_tag is True: @@ -851,9 +851,9 @@ class TestBuild(unittest.TestCase): buildtag_groups = [] buildtag_groups.append(set( - ['perl-Tangerine-0.23-1.module+814cfa39', - 'perl-List-Compare-0.53-5.module+814cfa39', - 'tangerine-0.22-3.module+814cfa39'])) + ['perl-Tangerine-0.23-1.module+0+814cfa39', + 'perl-List-Compare-0.53-5.module+0+814cfa39', + 'tangerine-0.22-3.module+0+814cfa39'])) def on_buildroot_add_artifacts_cb(cls, artifacts, install): self.assertEqual(buildtag_groups.pop(0), set(artifacts)) diff --git a/tests/test_builder/test_koji.py b/tests/test_builder/test_koji.py index a40974d9..159e4795 100644 --- a/tests/test_builder/test_koji.py +++ b/tests/test_builder/test_koji.py @@ -126,7 +126,7 @@ class TestKojiBuilder(unittest.TestCase): builder.module_tag = {"name": "module-foo", "id": 1} builder.module_build_tag = {"name": "module-foo-build", "id": 2} - dist_tag = 'module+b8661ee4' + dist_tag = 'module+1+b8661ee4' # Set listTagged to return test data builder.koji_session.listTagged.side_effect = [[], [], []] untagged = [{ diff --git a/tests/test_scheduler/test_poller.py b/tests/test_scheduler/test_poller.py index e69abb14..cb5e35be 100644 --- a/tests/test_scheduler/test_poller.py +++ b/tests/test_scheduler/test_poller.py @@ -385,10 +385,10 @@ class TestPoller(unittest.TestCase): self.assertEqual(module_build_two.state, models.BUILD_STATES['failed']) # Make sure the builds were untagged builder.untag_artifacts.assert_called_once_with([ - 'perl-Tangerine-0.23-1.module+814cfa39', - 'perl-List-Compare-0.53-5.module+814cfa39', - 'tangerine-0.22-3.module+814cfa39', - 'module-build-macros-0.1-1.module+814cfa39' + 'perl-Tangerine-0.23-1.module+0+814cfa39', + 'perl-List-Compare-0.53-5.module+0+814cfa39', + 'tangerine-0.22-3.module+0+814cfa39', + 'module-build-macros-0.1-1.module+0+814cfa39' ]) def test_cleanup_stale_failed_builds_no_components(self, create_builder, koji_get_session, diff --git a/tests/test_utils/test_utils.py b/tests/test_utils/test_utils.py index 091176c2..a48871d4 100644 --- a/tests/test_utils/test_utils.py +++ b/tests/test_utils/test_utils.py @@ -80,6 +80,7 @@ class FakeSCM(object): class TestUtils(unittest.TestCase): + maxDiff = None def setUp(self): self.filtered_rpms = [ diff --git a/tests/test_views/test_views.py b/tests/test_views/test_views.py index 18ee08d1..7a7dc24c 100644 --- a/tests/test_views/test_views.py +++ b/tests/test_views/test_views.py @@ -142,13 +142,13 @@ class TestViews(unittest.TestCase): 'task_id': 12312321, 'state': 1, 'state_reason': None, - 'nvr': 'module-build-macros-01-1.module+b8661ee4', + 'nvr': 'module-build-macros-01-1.module+0+b8661ee4', }, 'nginx': { 'task_id': 12312345, 'state': 1, 'state_reason': None, - 'nvr': 'nginx-1.10.1-2.module+b8661ee4', + 'nvr': 'nginx-1.10.1-2.module+0+b8661ee4', }, }, }) @@ -199,13 +199,13 @@ class TestViews(unittest.TestCase): 'task_id': 12312321, 'state': 1, 'state_reason': None, - 'nvr': 'module-build-macros-01-1.module+b8661ee4', + 'nvr': 'module-build-macros-01-1.module+0+b8661ee4', }, 'nginx': { 'task_id': 12312345, 'state': 1, 'state_reason': None, - 'nvr': 'nginx-1.10.1-2.module+b8661ee4', + 'nvr': 'nginx-1.10.1-2.module+0+b8661ee4', }, }, }) @@ -262,13 +262,13 @@ class TestViews(unittest.TestCase): 'tasks': { 'rpms': { 'module-build-macros': { - 'nvr': 'module-build-macros-01-1.module+8d3cee59', + 'nvr': 'module-build-macros-01-1.module+0+8d3cee59', 'state': 1, 'state_reason': None, 'task_id': 47384002 }, 'rubygem-rails': { - 'nvr': 'postgresql-9.5.3-4.module+8d3cee59', + 'nvr': 'postgresql-9.5.3-4.module+0+8d3cee59', 'state': 3, 'state_reason': None, 'task_id': 2433442 @@ -296,13 +296,13 @@ class TestViews(unittest.TestCase): 'tasks': { 'rpms': { 'module-build-macros': { - 'nvr': 'module-build-macros-01-1.module+0557c87d', + 'nvr': 'module-build-macros-01-1.module+0+0557c87d', 'state': 1, 'state_reason': None, 'task_id': 47384002 }, 'postgresql': { - 'nvr': 'postgresql-9.5.3-4.module+0557c87d', + 'nvr': 'postgresql-9.5.3-4.module+0+0557c87d', 'state': 1, 'state_reason': None, 'task_id': 2433442 @@ -391,7 +391,7 @@ class TestViews(unittest.TestCase): def test_query_component_builds_filter_nvr(self): rv = self.client.get('/module-build-service/1/component-builds/?nvr=nginx-1.10.1-2.' - 'module%2Bb8661ee4') + 'module%2B0%2Bb8661ee4') data = json.loads(rv.data) self.assertEquals(data['meta']['total'], 10)