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

Unified Diff: dashboard/dashboard/services/milo_service_test.py

Issue 2622503004: Add milo_service to perf dashboard. (Closed)
Patch Set: Add a clearer comment about jsonp prefix. 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
« no previous file with comments | « dashboard/dashboard/services/milo_service.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dashboard/dashboard/services/milo_service_test.py
diff --git a/dashboard/dashboard/services/milo_service_test.py b/dashboard/dashboard/services/milo_service_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..e1992e9d72a4e70aafb748ac7cb493d017053f32
--- /dev/null
+++ b/dashboard/dashboard/services/milo_service_test.py
@@ -0,0 +1,153 @@
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import unittest
+
+import base64
+import json
+import mock
+
+from dashboard.common import testing_common
+from dashboard.services import milo_service
+
+_BUILD_DETAILS = {
+ 'Master': 'chromium.perf',
+ 'blame': [
+ 'catapult-deps-roller@chromium.org',
+ 'sullivan@chromium.org',
+ ],
+ 'builderName': 'Android Nexus6 Perf (3)',
+ 'currentStep': None,
+ 'eta': None,
+ 'finished': True,
+ 'internal': False,
+ 'number': 4712,
+ 'osFamily': 'Debian',
+ 'osVersion': '14.04',
+ 'properties': [
+ [
+ 'branch',
+ 'master',
+ 'Build'
+ ],
+ [
+ 'buildbotURL',
+ 'http://build.chromium.org/p/chromium.perf/',
+ 'master.cfg'
+ ],
+ [
+ 'buildername',
+ 'Android Nexus6 Perf (3)',
+ 'Builder'
+ ],
+ [
+ 'buildnumber',
+ 4712,
+ 'Build'
+ ],
+ [
+ 'got_revision_cp',
+ 'refs/heads/master@{#442230}',
+ 'Annotation(bot_update)'
+ ],
+ ],
+ 'reason': 'scheduler',
+ 'results': 0,
+ 'slave': 'build45-b1',
+ 'steps': [
+ {
+ 'eta': None,
+ 'expectations': [],
+ 'hidden': False,
+ 'isFinished': True,
+ 'isStarted': True,
+ 'logs': [
+ [
+ 'stdio',
+ 'http://stdio'
+ ],
+ [
+ 'json.output',
+ 'http://json.output'
+ ],
+ ],
+ 'name': 'memory.top_10_mobile_stress',
+ 'results': [
+ 0,
+ []
+ ],
+ 'statistics': {},
+ 'step_number': 1,
+ },
+ {
+ 'eta': None,
+ 'expectations': [],
+ 'hidden': False,
+ 'isFinished': True,
+ 'isStarted': True,
+ 'logs': [
+ [
+ 'stdio',
+ 'http://stdio'
+ ],
+ [
+ 'json.output',
+ 'http://json.output'
+ ],
+ ],
+ 'name': 'page_cycler.typical_25',
+ 'results': [
+ 0,
+ []
+ ],
+ 'statistics': {},
+ 'step_number': 2,
+ },
+ {
+ 'eta': None,
+ 'expectations': [],
+ 'hidden': False,
+ 'isFinished': True,
+ 'isStarted': True,
+ 'logs': [
+ [
+ 'stdio',
+ 'http://stdio'
+ ],
+ [
+ 'json.output',
+ 'http://json.output'
+ ],
+ ],
+ 'name': 'sunspider',
+ 'results': [
+ 0,
+ []
+ ],
+ 'statistics': {},
+ 'step_number': 3,
+ },
+ ],
+}
+
+
+class MiloServiceTest(testing_common.TestCase):
+
+ def _GenerateResponse(self, build_details):
+ encoded_build_data = base64.b64encode(json.dumps(build_details))
+ response_content = '12345%s' % json.dumps({'data': encoded_build_data})
+ return testing_common.FakeResponseObject(200, response_content)
+
+ def testGetBuildbotBuildInfo(self):
+ mock_response = self._GenerateResponse(_BUILD_DETAILS)
+ with mock.patch('google.appengine.api.urlfetch.fetch',
+ mock.MagicMock(
+ return_value=mock_response)):
+ build_info = milo_service.GetBuildbotBuildInfo(
+ 'chromium.perf', 'Android Nexus6 Perf (3)', '4712')
+ self.assertEqual('chromium.perf', build_info['Master'])
+
+
+if __name__ == '__main__':
+ unittest.main()
« no previous file with comments | « dashboard/dashboard/services/milo_service.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698