From 7ebe0e59cdb771027c317bf086dd56658117bbc8 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Mar 16 2021 07:55:08 +0000 Subject: Set --koji-event also for RAW_CONFIG composes. Merges: https://pagure.io/odcs/pull-request/492 Signed-off-by: Jan Kaluza --- diff --git a/server/odcs/server/backend.py b/server/odcs/server/backend.py index 75365c9..738c98d 100644 --- a/server/odcs/server/backend.py +++ b/server/odcs/server/backend.py @@ -888,7 +888,10 @@ def generate_pungi_compose(compose): pungi_cfg.pkgset_allow_reuse = False koji_event = None - if compose.source_type == PungiSourceType.KOJI_TAG: + if compose.source_type in [ + PungiSourceType.KOJI_TAG, + PungiSourceType.RAW_CONFIG, + ]: koji_event = compose.koji_event old_compose = None diff --git a/server/tests/test_backend.py b/server/tests/test_backend.py index ececa21..ab113d1 100644 --- a/server/tests/test_backend.py +++ b/server/tests/test_backend.py @@ -1477,10 +1477,12 @@ class TestGeneratePungiCompose(ModelsBaseTest): # run asserts against it. self.pungi_config = None self.old_compose = None + self.pungi_koji_event = None def fake_pungi_run(pungi_cls, compose): self.pungi_config = pungi_cls.pungi_cfg self.old_compose = pungi_cls.old_compose + self.pungi_koji_event = pungi_cls.koji_event self.patch_pungi_run = patch("odcs.server.pungi.Pungi.run", autospec=True) self.pungi_run = self.patch_pungi_run.start() @@ -1648,6 +1650,7 @@ class TestGeneratePungiCompose(ModelsBaseTest): c.compose_type = "production" c.pungi_compose_id = "compose-1-10-2020110.n.0" c.id = 1 + c.koji_event = 123456 fake_raw_config_urls = { "pungi_cfg": { @@ -1658,6 +1661,7 @@ class TestGeneratePungiCompose(ModelsBaseTest): with patch.object(conf, "raw_config_urls", new=fake_raw_config_urls): generate_pungi_compose(c) + self.assertEqual(self.pungi_koji_event, c.koji_event) self.assertEqual(c.pungi_config_dump, "fake\npungi\nconf\n") self.assertEqual( self.pungi_config.pungi_cfg,