From 8994aa5d8896de5aa8fbb552ee921e575064ded0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Mon, 5 Aug 2019 10:56:44 +0200 Subject: [PATCH] pkgset: Added modules to variant in correct format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The data parsed from variants.xml uses a different format that what we added in `_add_module_to_variant`. This leads to crashes later. JIRA: COMPOSE-3746 Signed-off-by: Lubomír Sedlář --- pungi/phases/pkgset/sources/source_koji.py | 2 +- tests/test_pkgset_source_koji.py | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pungi/phases/pkgset/sources/source_koji.py b/pungi/phases/pkgset/sources/source_koji.py index cca8e05e..bd61597a 100644 --- a/pungi/phases/pkgset/sources/source_koji.py +++ b/pungi/phases/pkgset/sources/source_koji.py @@ -258,7 +258,7 @@ def _add_module_to_variant(koji_wrapper, variant, build, add_to_variant_modules= pass if add_to_variant_modules: - variant.modules.append(nsvc) + variant.modules.append({"name": nsvc, "glob": False}) return nsvc diff --git a/tests/test_pkgset_source_koji.py b/tests/test_pkgset_source_koji.py index b85948b7..579a48a2 100644 --- a/tests/test_pkgset_source_koji.py +++ b/tests/test_pkgset_source_koji.py @@ -702,7 +702,7 @@ class TestAddModuleToVariant(unittest.TestCase): arch_mmds={ "x86_64": {"m1:latest:20190101:cafe": MockModule("/koji/m1.x86_64.txt")} }, - modules=["m1:latest-20190101:cafe"], + modules=[{"name": "m1:latest-20190101:cafe", "glob": False}], ) source_koji._add_module_to_variant(self.koji, variant, self.buildinfo) @@ -719,7 +719,9 @@ class TestAddModuleToVariant(unittest.TestCase): }, }, ) - self.assertEqual(variant.modules, ["m1:latest-20190101:cafe"]) + self.assertEqual( + variant.modules, [{"name": "m1:latest-20190101:cafe", "glob": False}] + ) def test_adding_module_with_add_module(self): variant = mock.Mock( @@ -741,7 +743,9 @@ class TestAddModuleToVariant(unittest.TestCase): }, }, ) - self.assertEqual(variant.modules, ["module:master:20190318:abcdef"]) + self.assertEqual( + variant.modules, [{"name": "module:master:20190318:abcdef", "glob": False}] + ) def test_adding_module_to_existing_with_add_module(self): variant = mock.Mock( @@ -749,7 +753,7 @@ class TestAddModuleToVariant(unittest.TestCase): arch_mmds={ "x86_64": {"m1:latest:20190101:cafe": MockModule("/koji/m1.x86_64.txt")} }, - modules=["m1:latest-20190101:cafe"], + modules=[{"name": "m1:latest-20190101:cafe", "glob": False}], ) source_koji._add_module_to_variant( @@ -770,5 +774,8 @@ class TestAddModuleToVariant(unittest.TestCase): ) self.assertEqual( variant.modules, - ["m1:latest-20190101:cafe", "module:master:20190318:abcdef"], + [ + {"name": "m1:latest-20190101:cafe", "glob": False}, + {"name": "module:master:20190318:abcdef", "glob": False}, + ], )