diff --git a/requirements.txt b/requirements.txt index 2c9b107a..d8815d8a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,5 +5,4 @@ fedmsg modulemd pyOpenSSL kobo -koji munch diff --git a/rida/scheduler/handlers/modules.py b/rida/scheduler/handlers/modules.py index 3c7582b8..34b94642 100644 --- a/rida/scheduler/handlers/modules.py +++ b/rida/scheduler/handlers/modules.py @@ -61,7 +61,7 @@ def wait(config, session, msg): pdc_session = rida.pdc.get_pdc_client_session(config) tag = rida.pdc.get_module_tag(pdc_session, module_info, strict=True) - log.debug("Found tag=%s for module %r" % (tag, build)) + log.info("Found tag=%s for module %r" % (tag, build)) # Hang on to this information for later. We need to know which build is # associated with which koji tag, so that when their repos are regenerated diff --git a/tests/test_scheduler/test_module_wait.py b/tests/test_scheduler/test_module_wait.py index be7e4db5..dbf38afc 100644 --- a/tests/test_scheduler/test_module_wait.py +++ b/tests/test_scheduler/test_module_wait.py @@ -35,15 +35,17 @@ class TestModuleWait(unittest.TestCase): @mock.patch('rida.builder.KojiModuleBuilder') @mock.patch('rida.database.ModuleBuild.from_module_event') - @mock.patch('rida.pdc.get_pdc_client_session') - def test_wait_basic(self, pdc, from_module_event, KojiModuleBuilder): + @mock.patch('rida.pdc') + def test_init_basic(self, pdc, from_module_event, KojiModuleBuilder): builder = mock.Mock() + builder.get_disttag_srpm.return_value = 'some srpm disttag' KojiModuleBuilder.return_value = builder mocked_module_build = mock.Mock() mocked_module_build.json.return_value = { 'name': 'foo', 'version': 1, 'release': 1, + 'state': 'some state', } from_module_event.return_value = mocked_module_build @@ -51,6 +53,7 @@ class TestModuleWait(unittest.TestCase): 'topic': 'org.fedoraproject.prod.rida.module.state.change', 'msg': { 'id': 1, + 'state': 'some state', }, } self.fn(config=self.config, session=self.session, msg=msg) diff --git a/tests/test_scheduler/test_repo_done.py b/tests/test_scheduler/test_repo_done.py index 85afea6d..3e9abb7e 100644 --- a/tests/test_scheduler/test_repo_done.py +++ b/tests/test_scheduler/test_repo_done.py @@ -37,25 +37,27 @@ class TestRepoDone(unittest.TestCase): self.session = mock.Mock() self.fn = rida.scheduler.handlers.repos.done - @mock.patch('rida.database.ModuleBuild.get_active_by_koji_tag') - def test_no_match(self, get_active_by_koji_tag): + @mock.patch('rida.database.ModuleBuild.from_repo_done_event') + def test_no_match(self, from_repo_done_event): """ Test that when a repo msg hits us and we have no match, that we do nothing gracefully. """ - get_active_by_koji_tag.return_value = None + from_repo_done_event.return_value = None msg = { 'topic': 'org.fedoraproject.prod.buildsys.repo.done', 'msg': {'tag': 'no matches for this...'}, } self.fn(config=self.config, session=self.session, msg=msg) + @mock.patch('rida.builder.KojiModuleBuilder.get_session_from_config') @mock.patch('rida.builder.KojiModuleBuilder.build') @mock.patch('rida.builder.KojiModuleBuilder.buildroot_resume') - @mock.patch('rida.database.ModuleBuild.get_active_by_koji_tag') - def test_a_single_match(self, get_active_by_koji_tag, resume, build_fn): + @mock.patch('rida.database.ModuleBuild.from_repo_done_event') + def test_a_single_match(self, from_repo_done_event, resume, build_fn, config): """ Test that when a repo msg hits us and we have no match, that we do nothing gracefully. """ + config.return_value = mock.Mock(), "development" component_build = mock.Mock() component_build.package = 'foo' component_build.scmurl = 'full_scm_url' @@ -63,10 +65,10 @@ class TestRepoDone(unittest.TestCase): module_build = mock.Mock() module_build.component_builds = [component_build] - get_active_by_koji_tag.return_value = module_build + from_repo_done_event.return_value = module_build msg = { 'topic': 'org.fedoraproject.prod.buildsys.repo.done', 'msg': {'tag': 'no matches for this...'}, } self.fn(config=self.config, session=self.session, msg=msg) - build_fn.assert_called_once_with('TODO', 'full_scm_url') + build_fn.assert_called_once_with(artifact_name='foo', source='full_scm_url')