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

Unified Diff: dashboard/dashboard/models/stoppage_alert_test.py

Issue 1424393003: Stop creating stoppage alerts once a group has reached a certain size. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « dashboard/dashboard/models/stoppage_alert.py ('k') | dashboard/dashboard/mr.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dashboard/dashboard/models/stoppage_alert_test.py
diff --git a/dashboard/dashboard/models/stoppage_alert_test.py b/dashboard/dashboard/models/stoppage_alert_test.py
index 7e9e33bcb86783c619da05a5a4ce526c277e7cee..f8dd55575ed6ae22bcb20a1aa26ce317f31c139e 100644
--- a/dashboard/dashboard/models/stoppage_alert_test.py
+++ b/dashboard/dashboard/models/stoppage_alert_test.py
@@ -60,6 +60,32 @@ class StoppageAlertTest(testing_common.TestCase):
self.assertIsNotNone(
stoppage_alert.GetStoppageAlert(test.test_path, row.revision))
+ def testCreateStoppageAlert_DoesNotCreateLargeGroups(self):
+ # First, create |_MAX_GROUP_SIZE| alerts; all of them can be created
+ # and they all belong to the same group.
+ tests = map(str, range(stoppage_alert._MAX_GROUP_SIZE))
+ testing_common.AddTests(['M'], ['b'], {'suite': {t: {} for t in tests}})
+ test_paths = ['M/b/suite/' + t for t in tests]
+ rows = []
+ alerts = []
+ for path in test_paths:
+ rows = testing_common.AddRows(path, [1])
+ test = utils.TestKey(path).get()
+ new_alert = stoppage_alert.CreateStoppageAlert(test, rows[0])
+ self.assertIsNotNone(new_alert)
+ new_alert.put()
+ alerts.append(new_alert)
+ self.assertEqual(stoppage_alert._MAX_GROUP_SIZE, len(alerts))
+ self.assertTrue(all(a.group == alerts[0].group for a in alerts))
+
+ # Making one more stoppage alert that belongs to this group fails.
+ testing_common.AddTests(['M'], ['b'], {'suite': {'another': {}}})
+ test_path = 'M/b/suite/another'
+ rows = testing_common.AddRows(test_path, [1])
+ test = utils.TestKey(test_path).get()
+ new_alert = stoppage_alert.CreateStoppageAlert(test, rows[0])
+ self.assertIsNone(new_alert)
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « dashboard/dashboard/models/stoppage_alert.py ('k') | dashboard/dashboard/mr.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698