Chromium Code Reviews| Index: dashboard/dashboard/add_histograms_test.py |
| diff --git a/dashboard/dashboard/add_histograms_test.py b/dashboard/dashboard/add_histograms_test.py |
| index 1d5c9dbb8459b77d8a5077dfeb9857a28963f8dc..bdb36967346f04c324a738d97a63968d3cc61f78 100644 |
| --- a/dashboard/dashboard/add_histograms_test.py |
| +++ b/dashboard/dashboard/add_histograms_test.py |
| @@ -21,6 +21,7 @@ from dashboard.common import utils |
| from dashboard.models import histogram |
| from tracing.value import histogram as histogram_module |
| from tracing.value import histogram_set |
| +from tracing.value.diagnostics import reserved_infos |
| GOOGLER_USER = users.User(email='sullivan@chromium.org', |
| @@ -59,15 +60,9 @@ class AddHistogramsEndToEndTest(testing_common.TestCase): |
| 'storyDisplayName': 'story', |
| 'type': 'TelemetryInfo' |
| }, { |
| - 'angle': [], |
| - 'catapult': [], |
| - 'chromium': [], |
| - 'chromiumCommitPosition': [424242], |
| + 'values': [424242], |
| 'guid': '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| - 'skia': [], |
| - 'type': 'RevisionInfo', |
| - 'v8': [], |
| - 'webrtc': [] |
| + 'type': 'GenericSet', |
| }, { |
| 'buildNumber': 0, |
| 'buildbotMasterName': '', |
| @@ -81,7 +76,8 @@ class AddHistogramsEndToEndTest(testing_common.TestCase): |
| 'binBoundaries': [1, [1, 1000, 20]], |
| 'diagnostics': { |
| 'buildbot': 'e9c2891d-2b04-413f-8cf4-099827e67626', |
| - 'revisions': '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| + reserved_infos.CHROMIUM_COMMIT_POSITIONS.name: |
| + '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| 'telemetry': '0bc1021b-8107-4db7-bc8c-49d7cf53c5ae' |
| }, |
| 'guid': '2a714c36-f4ef-488d-8bee-93c7e3149388', |
| @@ -93,7 +89,8 @@ class AddHistogramsEndToEndTest(testing_common.TestCase): |
| self.ExecuteTaskQueueTasks('/add_histograms_queue', |
| add_histograms.TASK_QUEUE_NAME) |
| diagnostics = histogram.SparseDiagnostic.query().fetch() |
| - # We expect to see BuildbotInfo/TelemetryInfo, RevisionInfo is inlined. |
| + # We expect to see BuildbotInfo/TelemetryInfo, |
|
eakuefner
2017/08/08 21:18:15
I would just get rid of this comment.
|
| + # Chromium Commit Positions is inlined. |
| self.assertEqual(2, len(diagnostics)) |
| histograms = histogram.Histogram.query().fetch() |
| self.assertEqual(1, len(histograms)) |
| @@ -132,15 +129,9 @@ class AddHistogramsTest(testing_common.TestCase): |
| 'storyDisplayName': 'story', |
| 'type': 'TelemetryInfo' |
| }, { |
| - 'angle': [], |
| - 'catapult': [], |
| - 'chromium': [], |
| - 'chromiumCommitPosition': [424242], |
| + 'values': [424242], |
| 'guid': '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| - 'skia': [], |
| - 'type': 'RevisionInfo', |
| - 'v8': [], |
| - 'webrtc': [] |
| + 'type': 'GenericSet', |
| }, { |
| 'buildNumber': 0, |
| 'buildbotMasterName': '', |
| @@ -154,7 +145,8 @@ class AddHistogramsTest(testing_common.TestCase): |
| 'binBoundaries': [1, [1, 1000, 20]], |
| 'diagnostics': { |
| 'buildbot': 'e9c2891d-2b04-413f-8cf4-099827e67626', |
| - 'revisions': '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| + reserved_infos.CHROMIUM_COMMIT_POSITIONS.name: |
| + '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| 'telemetry': '0bc1021b-8107-4db7-bc8c-49d7cf53c5ae' |
| }, |
| 'guid': '4989617a-14d6-4f80-8f75-dafda2ff13b0', |
| @@ -164,7 +156,8 @@ class AddHistogramsTest(testing_common.TestCase): |
| 'binBoundaries': [1, [1, 1000, 20]], |
| 'diagnostics': { |
| 'buildbot': 'e9c2891d-2b04-413f-8cf4-099827e67626', |
| - 'revisions': '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| + reserved_infos.CHROMIUM_COMMIT_POSITIONS.name: |
| + '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| 'telemetry': '0bc1021b-8107-4db7-bc8c-49d7cf53c5ae' |
| }, |
| 'guid': '2a714c36-f4ef-488d-8bee-93c7e3149388', |
| @@ -200,15 +193,9 @@ class AddHistogramsTest(testing_common.TestCase): |
| 'storyDisplayName': 'story', |
| 'type': 'TelemetryInfo' |
| }, { |
| - 'angle': [], |
| - 'catapult': [], |
| - 'chromium': [], |
| - 'chromiumCommitPosition': [424242], |
| + 'values': [424242], |
| 'guid': '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| - 'skia': [], |
| - 'type': 'RevisionInfo', |
| - 'v8': [], |
| - 'webrtc': [] |
| + 'type': 'GenericSet', |
| }, { |
| 'buildNumber': 0, |
| 'buildbotMasterName': '', |
| @@ -222,7 +209,8 @@ class AddHistogramsTest(testing_common.TestCase): |
| 'binBoundaries': [1, [1, 1000, 20]], |
| 'diagnostics': { |
| 'buildbot': 'e9c2891d-2b04-413f-8cf4-099827e67626', |
| - 'revisions': '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| + reserved_infos.CHROMIUM_COMMIT_POSITIONS.name: |
| + '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| 'telemetry': '0bc1021b-8107-4db7-bc8c-49d7cf53c5ae' |
| }, |
| 'guid': '4989617a-14d6-4f80-8f75-dafda2ff13b0', |
| @@ -232,7 +220,8 @@ class AddHistogramsTest(testing_common.TestCase): |
| 'binBoundaries': [1, [1, 1000, 20]], |
| 'diagnostics': { |
| 'buildbot': 'e9c2891d-2b04-413f-8cf4-099827e67626', |
| - 'revisions': '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| + reserved_infos.CHROMIUM_COMMIT_POSITIONS.name: |
| + '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| 'telemetry': '0bc1021b-8107-4db7-bc8c-49d7cf53c5ae' |
| }, |
| 'guid': '2a714c36-f4ef-488d-8bee-93c7e3149388', |
| @@ -275,15 +264,9 @@ class AddHistogramsTest(testing_common.TestCase): |
| 'storyDisplayName': 'story', |
| 'type': 'TelemetryInfo' |
| }, { |
| - 'angle': [], |
| - 'catapult': [], |
| - 'chromium': [], |
| - 'chromiumCommitPosition': [424242], |
| + 'values': [424242], |
| 'guid': '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| - 'skia': [], |
| - 'type': 'RevisionInfo', |
| - 'v8': [], |
| - 'webrtc': [] |
| + 'type': 'GenericSet', |
| }, { |
| 'buildNumber': 0, |
| 'buildbotMasterName': '', |
| @@ -297,7 +280,8 @@ class AddHistogramsTest(testing_common.TestCase): |
| 'binBoundaries': [1, [1, 1000, 20]], |
| 'diagnostics': { |
| 'buildbot': 'e9c2891d-2b04-413f-8cf4-099827e67626', |
| - 'revisions': '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| + reserved_infos.CHROMIUM_COMMIT_POSITIONS.name: |
| + '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| 'telemetry': '0bc1021b-8107-4db7-bc8c-49d7cf53c5ae' |
| }, |
| 'guid': '4989617a-14d6-4f80-8f75-dafda2ff13b0', |
| @@ -341,15 +325,9 @@ class AddHistogramsTest(testing_common.TestCase): |
| 'storyDisplayName': 'story', |
| 'type': 'TelemetryInfo' |
| }, { |
| - 'angle': [], |
| - 'catapult': [], |
| - 'chromium': [], |
| - 'chromiumCommitPosition': [424242], |
| + 'values': [424242], |
| 'guid': '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| - 'skia': [], |
| - 'type': 'RevisionInfo', |
| - 'v8': [], |
| - 'webrtc': [] |
| + 'type': 'GenericSet', |
| }, { |
| 'buildNumber': 0, |
| 'buildbotMasterName': '', |
| @@ -363,7 +341,8 @@ class AddHistogramsTest(testing_common.TestCase): |
| 'binBoundaries': [1, [1, 1000, 20]], |
| 'diagnostics': { |
| 'buildbot': 'e9c2891d-2b04-413f-8cf4-099827e67626', |
| - 'revisions': '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| + reserved_infos.CHROMIUM_COMMIT_POSITIONS.name: |
| + '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| 'telemetry': '0bc1021b-8107-4db7-bc8c-49d7cf53c5ae' |
| }, |
| 'guid': '4989617a-14d6-4f80-8f75-dafda2ff13b0', |
| @@ -416,19 +395,14 @@ class AddHistogramsTest(testing_common.TestCase): |
| 'storyDisplayName': 'story', |
| 'type': 'TelemetryInfo' |
| }, { |
| - 'angle': [], |
| - 'catapult': [], |
| - 'chromium': [], |
| - 'chromiumCommitPosition': [424242], |
| + 'values': [424242], |
| 'guid': '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| - 'skia': [], |
| - 'type': 'RevisionInfo', |
| - 'v8': [], |
| - 'webrtc': [] |
| + 'type': 'GenericSet', |
| }, { |
| 'binBoundaries': [1, [1, 1000, 20]], |
| 'diagnostics': { |
| - 'revisions': '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| + reserved_infos.CHROMIUM_COMMIT_POSITIONS.name: |
| + '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| 'telemetry': '0bc1021b-8107-4db7-bc8c-49d7cf53c5ae' |
| }, |
| 'guid': '4989617a-14d6-4f80-8f75-dafda2ff13b0', |
| @@ -438,7 +412,7 @@ class AddHistogramsTest(testing_common.TestCase): |
| ]) |
| self.testapp.post('/add_histograms', {'data': data}, status=400) |
| - def testPostHistogramFailsWithoutRevisionInfo(self): |
| + def testPostHistogramFailsWithoutChromiumCommit(self): |
| data = json.dumps([ |
| { |
| 'benchmarkName': 'benchmark', |
| @@ -472,15 +446,9 @@ class AddHistogramsTest(testing_common.TestCase): |
| def testPostHistogramFailsWithoutTelemetryInfo(self): |
| data = json.dumps([ |
| { |
| - 'angle': [], |
| - 'catapult': [], |
| - 'chromium': [], |
| - 'chromiumCommitPosition': [424242], |
| + 'values': [424242], |
| 'guid': '25f0a111-9bb4-4cea-b0c1-af2609623160', |
| - 'skia': [], |
| - 'type': 'RevisionInfo', |
| - 'v8': [], |
| - 'webrtc': [] |
| + 'type': 'GenericSet', |
| }, { |
| 'buildNumber': 0, |
| 'buildbotMasterName': '', |
| @@ -494,7 +462,8 @@ class AddHistogramsTest(testing_common.TestCase): |
| 'binBoundaries': [1, [1, 1000, 20]], |
| 'diagnostics': { |
| 'buildbot': 'e9c2891d-2b04-413f-8cf4-099827e67626', |
| - 'revisions': '25f0a111-9bb4-4cea-b0c1-af2609623160' |
| + reserved_infos.CHROMIUM_COMMIT_POSITIONS.name: |
| + '25f0a111-9bb4-4cea-b0c1-af2609623160' |
| }, |
| 'guid': '4989617a-14d6-4f80-8f75-dafda2ff13b0', |
| 'name': 'foo', |
| @@ -553,19 +522,17 @@ class AddHistogramsTest(testing_common.TestCase): |
| def testComputeRevision(self): |
| hist = histogram_module.Histogram('hist', 'count') |
| histograms = histogram_set.HistogramSet([hist]) |
| - revision_info = histogram_module.RevisionInfo({ |
| - 'chromiumCommitPosition': [424242] |
| - }) |
| - histograms.AddSharedDiagnostic('revisions', revision_info) |
| + chromium_commit = histogram_module.GenericSet([424242]) |
| + histograms.AddSharedDiagnostic( |
| + reserved_infos.CHROMIUM_COMMIT_POSITIONS.name, chromium_commit) |
| self.assertEqual(424242, add_histograms.ComputeRevision(histograms)) |
| def testComputeRevision_RaisesOnError(self): |
| hist = histogram_module.Histogram('hist', 'count') |
| histograms = histogram_set.HistogramSet([hist]) |
| - revision_info = histogram_module.RevisionInfo({ |
| - 'chromiumCommitPosition': 424242 |
| - }) |
| - histograms.AddSharedDiagnostic('revisions', revision_info) |
| + chromium_commit = histogram_module.GenericSet([424242, 0]) |
| + histograms.AddSharedDiagnostic( |
| + reserved_infos.CHROMIUM_COMMIT_POSITIONS.name, chromium_commit) |
| with self.assertRaises(api_request_handler.BadRequestError): |
| add_histograms.ComputeRevision(histograms) |