Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(489)

Unified Diff: scripts/slave/unittests/gatekeeper_ng_test.py

Issue 105773005: Add ability to specify email subject for gatekeeper_ng. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« scripts/slave/gatekeeper_ng.py ('K') | « scripts/slave/gatekeeper_ng.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/unittests/gatekeeper_ng_test.py
diff --git a/scripts/slave/unittests/gatekeeper_ng_test.py b/scripts/slave/unittests/gatekeeper_ng_test.py
index 32309c87e278a358fa21d33ed13e1d62b0437eee..5a3c1134708d9906c3015de3311cdcbc484ce456 100755
--- a/scripts/slave/unittests/gatekeeper_ng_test.py
+++ b/scripts/slave/unittests/gatekeeper_ng_test.py
@@ -544,6 +544,27 @@ class GatekeeperTest(unittest.TestCase):
urls = self.call_gatekeeper()
self.assertNotIn(self.status_url, urls)
+ def testDefaultSubjectTemplate(self):
+ """Test that the subject template is set by default."""
+ sys.argv.extend([m.url for m in self.masters])
+ sys.argv.extend(['--skip-build-db-update',
+ '--json', self.gatekeeper_file,
+ '--email-app-secret-file=%s' % self.email_secret_file])
+
+ self.add_gatekeeper_section(self.masters[0].url,
+ self.masters[0].builders[0].name,
+ {'closing_steps': ['step4']})
+
+ self.call_gatekeeper()
+
+ # Check that gatekeeper indeed sent an email.
+ self.assertEquals(self.url_calls[-1]['url'], self.mailer_url)
+ mailer_data = GatekeeperTest.decode_param_json(self.url_calls[-1]['params'])
+ self.assertEquals(mailer_data['subject_template'], unicode(
+ 'buildbot %(result)s in %(projectName)s on %(builder)s, '
+ 'revision %(revision)s'))
+
+
def testEmailJson(self):
"""Test that the email json is formatted correctly."""
sys.argv.extend([m.url for m in self.masters])
@@ -551,12 +572,13 @@ class GatekeeperTest(unittest.TestCase):
'--json', self.gatekeeper_file,
'--email-app-secret-file=%s' % self.email_secret_file])
+ subject_template = 'build %(result)s, oh no!'
self.masters[0].builders[0].builds[0].results = 3
self.add_gatekeeper_master_config(self.masters[0].url,
{'respect_build_status': True})
self.add_gatekeeper_section(self.masters[0].url,
self.masters[0].builders[0].name,
- {},
+ {'subject_template': subject_template},
idx=0)
self.call_gatekeeper()
@@ -597,6 +619,8 @@ class GatekeeperTest(unittest.TestCase):
self.assertEquals(mailer_data['build_url'], unicode(build_url))
self.assertEquals(mailer_data['project_name'], unicode('Chromium FYI'))
self.assertEquals(mailer_data['from_addr'], 'buildbot@chromium.org')
+ self.assertEquals(mailer_data['subject_template'],
+ unicode(subject_template))
#### BuildDB operation.
« scripts/slave/gatekeeper_ng.py ('K') | « scripts/slave/gatekeeper_ng.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698