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

Side by Side Diff: scripts/slave/unittests/results_dashboard_test.py

Issue 2346963003: Updating perf recipe for disabled chartjson data. (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Test cases for results_dashboard.""" 6 """Test cases for results_dashboard."""
7 7
8 import datetime 8 import datetime
9 import json 9 import json
10 import os 10 import os
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 def test_MakeDashboardJsonV1(self): 44 def test_MakeDashboardJsonV1(self):
45 self.mox.StubOutWithMock(slave_utils, 'GetActiveMaster') 45 self.mox.StubOutWithMock(slave_utils, 'GetActiveMaster')
46 slave_utils.GetActiveMaster().AndReturn('ChromiumPerf') 46 slave_utils.GetActiveMaster().AndReturn('ChromiumPerf')
47 self.mox.StubOutWithMock(results_dashboard, '_GetTimestamp') 47 self.mox.StubOutWithMock(results_dashboard, '_GetTimestamp')
48 # pylint: disable=W0212 48 # pylint: disable=W0212
49 results_dashboard._GetTimestamp().AndReturn(307226) 49 results_dashboard._GetTimestamp().AndReturn(307226)
50 results_dashboard._GetTimestamp().AndReturn(307226) 50 results_dashboard._GetTimestamp().AndReturn(307226)
51 self.mox.ReplayAll() 51 self.mox.ReplayAll()
52 52
53 v1json = results_dashboard.MakeDashboardJsonV1( 53 v1json = results_dashboard.MakeDashboardJsonV1(
54 {'some_json': 'from_telemetry'}, 54 {'some_json': 'from_telemetry', 'disabled': False},
55 { 55 {
56 'rev': 'f46bf3c', 56 'rev': 'f46bf3c',
57 'git_revision': 'f46bf3c', 57 'git_revision': 'f46bf3c',
58 'v8_rev': '73a34f', 58 'v8_rev': '73a34f',
59 'commit_pos': 307226 59 'commit_pos': 307226
60 }, 60 },
61 'foo_test', 61 'foo_test',
62 'my-bot', 62 'my-bot',
63 'Builder', 63 'Builder',
64 '10', 64 '10',
65 {'a_annotation': 'xyz', 'r_my_rev': '789abc01'}, 65 {'a_annotation': 'xyz', 'r_my_rev': '789abc01'},
66 True) 66 True)
67 self.assertEqual( 67 self.assertEqual((False,
68 { 68 {
69 'master': 'ChromiumPerf', 69 'master': 'ChromiumPerf',
70 'bot': 'my-bot', 70 'bot': 'my-bot',
71 'chart_data': {'some_json': 'from_telemetry'}, 71 'chart_data': {'some_json': 'from_telemetry', 'disabled': False},
72 'is_ref': True, 72 'is_ref': True,
73 'test_suite_name': 'foo_test', 73 'test_suite_name': 'foo_test',
74 'point_id': 307226, 74 'point_id': 307226,
75 'supplemental': { 75 'supplemental': {
76 'annotation': 'xyz', 76 'annotation': 'xyz',
77 'a_stdio_uri': ('[Buildbot stdio](http://build.chromium.org/p' 77 'a_stdio_uri': ('[Buildbot stdio](http://build.chromium.org/p'
78 '/my.master/builders/Builder/builds/10/steps/' 78 '/my.master/builders/Builder/builds/10/steps/'
79 'foo_test/logs/stdio)') 79 'foo_test/logs/stdio)')
80 }, 80 },
81 'versions': { 81 'versions': {
82 'v8_rev': '73a34f', 82 'v8_rev': '73a34f',
83 'chromium': 'f46bf3c', 83 'chromium': 'f46bf3c',
84 'my_rev': '789abc01' 84 'my_rev': '789abc01'
85 } 85 }
86 }, 86 }),
87 v1json)
88
89 def test_MakeDashboardJsonV1WithDisabledBenchmark(self):
90 v1json = results_dashboard.MakeDashboardJsonV1(
91 {'some_json': 'from_telemetry', 'disabled': True},
92 {},
93 'foo_test',
94 'my-bot',
95 'Builder',
96 '10',
97 {'a_annotation': 'xyz', 'r_my_rev': '789abc01'},
98 True)
99 self.assertEqual(
100 (True, {'some_json': 'from_telemetry', 'disabled': True}),
87 v1json) 101 v1json)
88 102
89 def test_MakeListOfPoints_MinimalCase(self): 103 def test_MakeListOfPoints_MinimalCase(self):
90 """A very simple test of a call to MakeListOfPoints.""" 104 """A very simple test of a call to MakeListOfPoints."""
91 105
92 # The master name is gotten when making the list of points, 106 # The master name is gotten when making the list of points,
93 # so it must be stubbed out here. 107 # so it must be stubbed out here.
94 self.mox.StubOutWithMock(slave_utils, 'GetActiveMaster') 108 self.mox.StubOutWithMock(slave_utils, 'GetActiveMaster')
95 slave_utils.GetActiveMaster().AndReturn('MyMaster') 109 slave_utils.GetActiveMaster().AndReturn('MyMaster')
96 self.mox.ReplayAll() 110 self.mox.ReplayAll()
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 'revision': 1234, 417 'revision': 1234,
404 'value': 10, 418 'value': 10,
405 }])) 419 }]))
406 420
407 def test_LinkAnnotation_UnexpectedData(self): 421 def test_LinkAnnotation_UnexpectedData(self):
408 self.assertIsNone(results_dashboard._LinkAnnotation('', {})) 422 self.assertIsNone(results_dashboard._LinkAnnotation('', {}))
409 423
410 424
411 if __name__ == '__main__': 425 if __name__ == '__main__':
412 unittest.main() 426 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698