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

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

Issue 2346963003: Updating perf recipe for disabled chartjson data. (Closed)
Patch Set: responding to review comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « scripts/slave/unittests/results_dashboard_test.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/runtest_test.py
diff --git a/scripts/slave/unittests/runtest_test.py b/scripts/slave/unittests/runtest_test.py
index 282b1d773b49b30e6f886d6cbbb5b25a80408a55..3d1da460a0553b051bd15bbd23f13f62f457e7c4 100755
--- a/scripts/slave/unittests/runtest_test.py
+++ b/scripts/slave/unittests/runtest_test.py
@@ -170,13 +170,15 @@ class SendResultsToDashboardTest(unittest.TestCase):
"""Tests that the right methods get called in _SendResultsToDashboard."""
# Since this method just tests that certain methods get called when
# a call to _SendResultsDashboard is made, the data used below is arbitrary.
- fake_json_data = {'chart': {'traces': {'x': [1, 0]}, 'rev': 1000}}
+ fake_json_data = {
+ 'chart': {'traces': {'x': [1, 0]}, 'rev': 1000}, 'enabled': True}
fake_results_tracker = mock.Mock()
fake_results_tracker.IsChartJson = mock.MagicMock(return_value=True)
fake_results_tracker.ChartJson = mock.MagicMock(return_value=fake_json_data)
fake_results_tracker.IsReferenceBuild = mock.MagicMock(return_value=False)
fake_results_tracker.Cleanup = mock.MagicMock()
- MakeDashboardJsonV1.return_value = {'doesnt': 'matter'}
+ fake_results = {'doesnt': 'matter', 'chart_data': {'enabled': True}}
+ MakeDashboardJsonV1.return_value = fake_results
result = runtest._SendResultsToDashboard(
fake_results_tracker, {
@@ -197,7 +199,7 @@ class SendResultsToDashboardTest(unittest.TestCase):
# Then a function is called to send the data (and any cached data).
SendResults.assert_called_with(
- {'doesnt': 'matter'}, 'http://x.com', 'builddir')
+ fake_results, 'http://x.com', 'builddir')
fake_results_tracker.Cleanup.assert_called_with()
# No errors, should return True.
@@ -205,6 +207,46 @@ class SendResultsToDashboardTest(unittest.TestCase):
@mock.patch('slave.results_dashboard.MakeDashboardJsonV1')
@mock.patch('slave.results_dashboard.SendResults')
+ def test_SendResultsToDashboard_DisabledBenchmark(
+ self, SendResults, MakeDashboardJsonV1):
+ """Tests that the right methods get called in _SendResultsToDashboard."""
+ # Since this method just tests that certain methods get called when
+ # a call to _SendResultsDashboard is made, the data used below is arbitrary.
+ fake_json_data = {'chart': {'traces': {'x': [1, 0]}, 'rev': 1000},
+ 'enabled': True}
+ fake_results_tracker = mock.Mock()
+ fake_results_tracker.IsChartJson = mock.MagicMock(return_value=True)
+ fake_results_tracker.ChartJson = mock.MagicMock(return_value=fake_json_data)
+ fake_results_tracker.IsReferenceBuild = mock.MagicMock(return_value=False)
+ fake_results_tracker.Cleanup = mock.MagicMock()
+ fake_results = {'doesnt': 'matter', 'chart_data': {'enabled': False}}
+ MakeDashboardJsonV1.return_value = fake_results
+
+ result = runtest._SendResultsToDashboard(
+ fake_results_tracker, {
+ 'system': 'linux',
+ 'test': 'sunspider',
+ 'url': 'http://x.com',
+ 'build_dir': 'builddir',
+ 'mastername': 'my.master',
+ 'buildername': 'Builder',
+ 'buildnumber': 123,
+ 'revisions': {'rev': 343},
+ 'supplemental_columns': {}})
+
+ # Then the data is re-formatted to a format that the dashboard accepts.
+ MakeDashboardJsonV1.assert_called_with(
+ fake_json_data, {'rev': 343}, 'sunspider', 'linux',
+ 'Builder', 123, {}, False)
+
+ # Make sure SendResults isn't called because the benchmarks is disabled
+ self.assertFalse(SendResults.called)
+
+ # No errors, should return True since disabled run is successful.
+ self.assertTrue(result)
+
+ @mock.patch('slave.results_dashboard.MakeDashboardJsonV1')
+ @mock.patch('slave.results_dashboard.SendResults')
def test_SendResultsToDashboard_NoTelemetryOutput(
self, SendResults, MakeDashboardJsonV1):
"""Tests that the right methods get called in _SendResultsToDashboard."""
« no previous file with comments | « scripts/slave/unittests/results_dashboard_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698