From d974389d3141df7f9da3e41298a5ab2d74e0c9e3 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Oct 19 2017 14:57:43 +0000 Subject: Make all the update. and dist. test send test.taskotron messages Signed-off-by: Pierre-Yves Chibon --- diff --git a/rats/lib/__init__.py b/rats/lib/__init__.py index 8c4acf6..7359768 100644 --- a/rats/lib/__init__.py +++ b/rats/lib/__init__.py @@ -129,9 +129,14 @@ class KojiBuildBackend(Backend): # Check if there was a request made recently to lower the DDOS risk + title = test + # Make all the ``dist.`` tests be taskotron + if test.startswith('dist.'): + title = 'taskotron' + # All clear, send a fedmsg asking for the test to be re-run fedmsg_publish( - topic='test.%s' % test, + topic='test.%s' % title, msg=dict( test=test, identifier=identifier, @@ -165,9 +170,14 @@ class BodhiUpdateBackend(Backend): # Check if there was a request made recently to lower the DDOS risk + title = test + # Make all the ``update.`` tests be taskotron + if test.startswith('update.'): + title = 'taskotron' + # All clear, send a fedmsg asking for the test to be re-run fedmsg_publish( - topic='test.%s' % test, + topic='test.%s' % title, msg=dict( test=test, identifier=identifier, diff --git a/tests/lib/test_tasks.py b/tests/lib/test_tasks.py index 6629703..9ad9f25 100644 --- a/tests/lib/test_tasks.py +++ b/tests/lib/test_tasks.py @@ -162,7 +162,7 @@ class TasksTestsSimple(BaseTests): self.assertEqual( args[1].keys(), ['topic', 'msg', 'modname', 'active', 'cert_prefix']) - self.assertEqual(args[1].get('topic'), 'test.update.base_selinux') + self.assertEqual(args[1].get('topic'), 'test.taskotron') self.assertEqual(args[1].get('active'), True) self.assertEqual(args[1].get('cert_prefix'), 'rats') self.assertEqual(args[1].get('modname'), 'rats') @@ -171,6 +171,7 @@ class TasksTestsSimple(BaseTests): ['test', 'identifier', 'agent', 'extras'] ) self.assertIsNone(args[1]['msg']['extras']) + self.assertEqual(args[1]['msg']['test'], 'update.base_selinux') @patch('fedmsg.publish', MagicMock(side_effect=Exception)) def test_process_bodhi_request_no_fedmsg(self): @@ -226,7 +227,7 @@ class TasksTestsSimple(BaseTests): self.assertEqual( args[1].keys(), ['topic', 'msg', 'modname', 'active', 'cert_prefix']) - self.assertEqual(args[1].get('topic'), 'test.dist.rpmdeplint') + self.assertEqual(args[1].get('topic'), 'test.taskotron') self.assertEqual(args[1].get('active'), True) self.assertEqual(args[1].get('cert_prefix'), 'rats') self.assertEqual(args[1].get('modname'), 'rats') @@ -235,6 +236,7 @@ class TasksTestsSimple(BaseTests): ['test', 'identifier', 'agent', 'extras'] ) self.assertIsNone(args[1]['msg']['extras']) + self.assertEqual(args[1]['msg']['test'], 'dist.rpmdeplint') @patch.dict( 'rats.config',