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

Unified Diff: dashboard/dashboard/create_health_report_test.py

Issue 2648683004: Building the table for speed releasing. (Closed)
Patch Set: Added more logging Created 3 years, 11 months 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
Index: dashboard/dashboard/create_health_report_test.py
diff --git a/dashboard/dashboard/create_health_report_test.py b/dashboard/dashboard/create_health_report_test.py
index f3aadac29b48403e290b7586c25796b70816f871..71b5ebb85eec4397992eeb213a950b87c5ca705f 100644
--- a/dashboard/dashboard/create_health_report_test.py
+++ b/dashboard/dashboard/create_health_report_test.py
@@ -20,8 +20,9 @@ _SAMPLE_TABLE_CONFIG = {
'tableName': 'my_sample_config',
'tableBots': 'ChromiumPerf/win\nChromiumPerf/linux',
'tableTests': 'my_test_suite/my_test\nmy_test_suite/my_other_test',
- 'tableLayout': '{ "system_health.memory_mobile/foreground/ashmem":'
- '["Foreground", "Ashmem"]}',
+ 'tableLayout': '{"my_test_suite/my_test": ["Foreground", '
+ '"Pretty Name 1"], "my_test_suite/my_other_test": '
+ '["Foreground", "Pretty Name 2"]}',
}
class CreateHealthReportTest(testing_common.TestCase):
@@ -42,27 +43,30 @@ class CreateHealthReportTest(testing_common.TestCase):
def _AddInternalBotsToDataStore(self):
"""Adds sample bot/master pairs."""
- master_key = ndb.Key('Master', 'ChromiumPerf')
- graph_data.Bot(
- id='win', parent=master_key, internal_only=True).put()
- graph_data.Bot(
- id='linux', parent=master_key, internal_only=True).put()
+ self._AddTests()
+ bots = graph_data.Bot.query().fetch()
+ for bot in bots:
+ bot.internal_only = True
+ bot.put()
def _AddMixedBotsToDataStore(self):
"""Adds sample bot/master pairs."""
- master_key = ndb.Key('Master', 'ChromiumPerf')
- graph_data.Bot(
- id='win', parent=master_key, internal_only=False).put()
- graph_data.Bot(
- id='linux', parent=master_key, internal_only=True).put()
+ self._AddTests()
+ bots = graph_data.Bot.query().fetch()
+ bots[1].internal_only = True
+ bots[1].put()
def _AddPublicBotsToDataStore(self):
"""Adds sample bot/master pairs."""
- master_key = ndb.Key('Master', 'ChromiumPerf')
- graph_data.Bot(
- id='win', parent=master_key, internal_only=False).put()
- graph_data.Bot(
- id='linux', parent=master_key, internal_only=False).put()
+ self._AddTests()
+
+ def _AddTests(self):
+ testing_common.AddTests(['ChromiumPerf'], ['win', 'linux'], {
+ 'my_test_suite': {
+ 'my_test': {},
+ 'my_other_test': {},
+ }
+ })
def testPost_NoXSRFToken_Returns403Error(self):
self.testapp.post('/create_health_report', {
@@ -107,8 +111,9 @@ class CreateHealthReportTest(testing_common.TestCase):
bots = [win_bot, linux_bot]
self.assertEqual(bots, table_entity.bots)
self.assertEqual(
- '{ "system_health.memory_mobile/foreground/ashmem":'
- '["Foreground", "Ashmem"]}', table_entity.table_layout)
+ '{"my_test_suite/my_test": ["Foreground", "Pretty Name 1"], '
+ '"my_test_suite/my_other_test": ["Foreground", "Pretty Name 2"]}',
+ table_entity.table_layout)
def testPost_EmptyForm(self):
response = self.testapp.post('/create_health_report', {
@@ -134,8 +139,8 @@ class CreateHealthReportTest(testing_common.TestCase):
response = self.testapp.post('/create_health_report', {
'tableName': 'myName',
'tableBots': 'garbage/moarGarbage',
- 'tableTests': 'someTests',
- 'tableLayout': '{A layout}',
+ 'tableTests': 'my_test_suite/my_test',
+ 'tableLayout': '{"Alayout":"isHere"}',
'xsrf_token': xsrf.GenerateToken(users.get_current_user()),
})
self.assertIn('Invalid Master/Bot: garbage/moarGarbage', response)
@@ -166,7 +171,7 @@ class CreateHealthReportTest(testing_common.TestCase):
response = self.testapp.post('/create_health_report', {
'tableName': 'myName',
'tableBots': 'ChromiumPerf/linux',
- 'tableTests': 'someTests',
+ 'tableTests': 'my_test_suite/my_test',
'tableLayout': 'garbage',
'xsrf_token': xsrf.GenerateToken(users.get_current_user()),
})
@@ -174,3 +179,19 @@ class CreateHealthReportTest(testing_common.TestCase):
query = table_config.TableConfig.query()
table_values = query.fetch()
self.assertEqual(len(table_values), 0)
+
+ def testPost_InvalidTests(self):
+ self._AddInternalBotsToDataStore()
+ _SAMPLE_TABLE_CONFIG['xsrf_token'] = xsrf.GenerateToken(
+ users.get_current_user())
+ response = self.testapp.post('/create_health_report', {
+ 'tableName': 'myName',
+ 'tableBots': 'ChromiumPerf/linux',
+ 'tableTests': 'someTests',
+ 'tableLayout': '{"Alayout":"isHere"}',
+ 'xsrf_token': xsrf.GenerateToken(users.get_current_user()),
+ })
+ self.assertIn('someTests is not a valid test.', response)
+ query = table_config.TableConfig.query()
+ table_values = query.fetch()
+ self.assertEqual(len(table_values), 0)

Powered by Google App Engine
This is Rietveld 408576698