| 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 datetime | 5 import datetime |
| 6 import json | 6 import json |
| 7 import mock | 7 import mock |
| 8 import urllib2 | 8 import urllib2 |
| 9 | 9 |
| 10 from google.appengine.datastore import datastore_stub_util | 10 from google.appengine.datastore import datastore_stub_util |
| 11 from google.appengine.ext import ndb | 11 from google.appengine.ext import ndb |
| 12 from google.appengine.runtime import DeadlineExceededError | 12 from google.appengine.runtime import DeadlineExceededError |
| 13 | 13 |
| 14 import gae_ts_mon | 14 import gae_ts_mon |
| 15 import main | 15 import main |
| 16 from model.build_run import BuildRun, PatchsetBuilderRuns | 16 from model.build_run import BuildRun, PatchsetBuilderRuns |
| 17 from model.fetch_status import FetchStatus | 17 from model.fetch_status import FetchStatus |
| 18 from model.flake import Flake, FlakyRun | 18 from model.flake import Flake, FlakyRun |
| 19 from status import cq_status | 19 from status import cq_status |
| 20 from testing_utils import testing | 20 from testing_utils import testing |
| 21 from time_functions.testing import mock_datetime_utc | 21 from infra_libs.time_functions.testing import mock_datetime_utc |
| 22 | 22 |
| 23 | 23 |
| 24 # Test results below capture various variants in which results may be processed. | 24 # Test results below capture various variants in which results may be processed. |
| 25 # Special attention should be paid to the 'issue' and 'patchset' fields as code | 25 # Special attention should be paid to the 'issue' and 'patchset' fields as code |
| 26 # is expected to correctly process results from different issues and patchsets | 26 # is expected to correctly process results from different issues and patchsets |
| 27 # independently of each other. | 27 # independently of each other. |
| 28 TEST_CQ_STATUS_RESPONSE = json.dumps({ | 28 TEST_CQ_STATUS_RESPONSE = json.dumps({ |
| 29 'more': False, | 29 'more': False, |
| 30 'cursor': '', | 30 'cursor': '', |
| 31 'results': [ | 31 'results': [ |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 self.assertEqual(set(Flake.get_by_id('foo').occurrences), set(new_flakes)) | 627 self.assertEqual(set(Flake.get_by_id('foo').occurrences), set(new_flakes)) |
| 628 | 628 |
| 629 # Kept old flakes since there are just 50 new flakes. | 629 # Kept old flakes since there are just 50 new flakes. |
| 630 self.assertEqual(len(Flake.get_by_id('bar').occurrences), 150) | 630 self.assertEqual(len(Flake.get_by_id('bar').occurrences), 150) |
| 631 | 631 |
| 632 # Make sure that non existant flake got removed. | 632 # Make sure that non existant flake got removed. |
| 633 self.assertNotIn(non_existant_flake, Flake.get_by_id('bar').occurrences) | 633 self.assertNotIn(non_existant_flake, Flake.get_by_id('bar').occurrences) |
| 634 | 634 |
| 635 # Make sure that we do not delete any FlakyRun entities. | 635 # Make sure that we do not delete any FlakyRun entities. |
| 636 self.assertEqual(FlakyRun.query().count(limit=300), 200) | 636 self.assertEqual(FlakyRun.query().count(limit=300), 200) |
| OLD | NEW |