OLD | NEW |
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 Loading... |
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() |
OLD | NEW |