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

Side by Side Diff: dashboard/dashboard/find_anomalies_test.py

Issue 2627073006: Add a ref_test key to Anomaly entities and surface it in alerts JSON. (Closed)
Patch Set: Address review comments 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 unified diff | Download patch
« no previous file with comments | « dashboard/dashboard/find_anomalies.py ('k') | dashboard/dashboard/models/anomaly.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import sys 5 import sys
6 import unittest 6 import unittest
7 7
8 import mock 8 import mock
9 9
10 from dashboard import find_anomalies 10 from dashboard import find_anomalies
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 '%s; setting last_alerted_revision to None.', 363 '%s; setting last_alerted_revision to None.',
364 1234567890, 364 1234567890,
365 10066, 365 10066,
366 'ChromiumGPU/linux-release/scrolling_benchmark/ref'), 366 'ChromiumGPU/linux-release/scrolling_benchmark/ref'),
367 mock.call( 367 mock.call(
368 'No rows fetched for %s', 368 'No rows fetched for %s',
369 'ChromiumGPU/linux-release/scrolling_benchmark/ref') 369 'ChromiumGPU/linux-release/scrolling_benchmark/ref')
370 ] 370 ]
371 mock_logging_error.assert_has_calls(calls, any_order=True) 371 mock_logging_error.assert_has_calls(calls, any_order=True)
372 372
373 def testMakeAnomalyEntity_NoRefBuild(self):
374 testing_common.AddTests(
375 ['ChromiumPerf'],
376 ['linux'], {
377 'page_cycler_v2': {
378 'cnn': {},
379 'yahoo': {},
380 'nytimes': {},
381 },
382 })
383 test = utils.TestKey('ChromiumPerf/linux/page_cycler_v2').get()
384 testing_common.AddRows(test.test_path, [100, 200, 300, 400])
385
386 alert = find_anomalies._MakeAnomalyEntity(
387 _MakeSampleChangePoint(10011, 50, 100),
388 test,
389 list(graph_data.Row.query()))
390 self.assertIsNone(alert.ref_test)
391
392 def testMakeAnomalyEntity_RefBuildSlash(self):
393 testing_common.AddTests(
394 ['ChromiumPerf'],
395 ['linux'], {
396 'page_cycler_v2': {
397 'ref': {},
398 'cnn': {},
399 'yahoo': {},
400 'nytimes': {},
401 },
402 })
403 test = utils.TestKey('ChromiumPerf/linux/page_cycler_v2').get()
404 testing_common.AddRows(test.test_path, [100, 200, 300, 400])
405
406 alert = find_anomalies._MakeAnomalyEntity(
407 _MakeSampleChangePoint(10011, 50, 100),
408 test,
409 list(graph_data.Row.query()))
410 self.assertEqual(alert.ref_test.string_id(),
411 'ChromiumPerf/linux/page_cycler_v2/ref')
412
413 def testMakeAnomalyEntity_RefBuildUnderscore(self):
414 testing_common.AddTests(
415 ['ChromiumPerf'],
416 ['linux'], {
417 'page_cycler_v2': {
418 'cnn': {},
419 'cnn_ref': {},
420 'yahoo': {},
421 'nytimes': {},
422 },
423 })
424 test = utils.TestKey('ChromiumPerf/linux/page_cycler_v2/cnn').get()
425 testing_common.AddRows(test.test_path, [100, 200, 300, 400])
426
427 alert = find_anomalies._MakeAnomalyEntity(
428 _MakeSampleChangePoint(10011, 50, 100),
429 test,
430 list(graph_data.Row.query()))
431 self.assertEqual(alert.ref_test.string_id(),
432 'ChromiumPerf/linux/page_cycler_v2/cnn_ref')
433
373 434
374 if __name__ == '__main__': 435 if __name__ == '__main__':
375 unittest.main() 436 unittest.main()
OLDNEW
« no previous file with comments | « dashboard/dashboard/find_anomalies.py ('k') | dashboard/dashboard/models/anomaly.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698