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

Side by Side Diff: appengine/chromium_try_flakes/handlers/test/flake_issues_test.py

Issue 1829023003: Revert of gae_ts_mon: instrument Cloud Endpoint methods (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 9 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
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 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 12
13 from handlers.flake_issues import ProcessIssue, CreateFlakyRun 13 from handlers.flake_issues import ProcessIssue, CreateFlakyRun
14 import main 14 import main
15 from infra_libs import ts_mon
16 from model.flake import Flake, FlakyRun, FlakeOccurrence 15 from model.flake import Flake, FlakyRun, FlakeOccurrence
17 from model.build_run import PatchsetBuilderRuns, BuildRun 16 from model.build_run import PatchsetBuilderRuns, BuildRun
18 from testing_utils import testing 17 from testing_utils import testing
19 from time_functions.testing import mock_datetime_utc 18 from time_functions.testing import mock_datetime_utc
20 19
21 20
22 TEST_TEST_RESULTS_REPLY = json.dumps({ 21 TEST_TEST_RESULTS_REPLY = json.dumps({
23 'tests': { 22 'tests': {
24 'test1': { 23 'test1': {
25 'expected': 'PASS', 24 'expected': 'PASS',
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 136
138 # This is needed to be able to test handlers using cross-group transactions. 137 # This is needed to be able to test handlers using cross-group transactions.
139 datastore_stub_consistency_policy = ( 138 datastore_stub_consistency_policy = (
140 datastore_stub_util.PseudoRandomHRConsistencyPolicy(probability=1)) 139 datastore_stub_util.PseudoRandomHRConsistencyPolicy(probability=1))
141 140
142 # Needed to read queues from queue.yaml in the root of the app. 141 # Needed to read queues from queue.yaml in the root of the app.
143 taskqueue_stub_root_path = '.' 142 taskqueue_stub_root_path = '.'
144 143
145 def setUp(self): 144 def setUp(self):
146 super(FlakeIssuesTestCase, self).setUp() 145 super(FlakeIssuesTestCase, self).setUp()
147 ts_mon.reset_for_unittest(disable=True)
148 self.mock_api = MockIssueTrackerAPI() 146 self.mock_api = MockIssueTrackerAPI()
149 self.patchers = [ 147 self.patchers = [
150 mock.patch('issue_tracker.issue_tracker_api.IssueTrackerAPI', 148 mock.patch('issue_tracker.issue_tracker_api.IssueTrackerAPI',
151 lambda *args, **kwargs: self.mock_api), 149 lambda *args, **kwargs: self.mock_api),
152 mock.patch('issue_tracker.issue.Issue', MockIssue), 150 mock.patch('issue_tracker.issue.Issue', MockIssue),
153 ] 151 ]
154 for patcher in self.patchers: 152 for patcher in self.patchers:
155 patcher.start() 153 patcher.start()
156 154
157 def tearDown(self): 155 def tearDown(self):
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 740
743 for flake in flakes: 741 for flake in flakes:
744 self.assertEqual(flake.occurrences, [flaky_run.key]) 742 self.assertEqual(flake.occurrences, [flaky_run.key])
745 743
746 def test_flattens_tests_correctly(self): 744 def test_flattens_tests_correctly(self):
747 passed, failed, skipped = CreateFlakyRun._flatten_tests( 745 passed, failed, skipped = CreateFlakyRun._flatten_tests(
748 json.loads(TEST_TEST_RESULTS_REPLY)['tests'], '/') 746 json.loads(TEST_TEST_RESULTS_REPLY)['tests'], '/')
749 self.assertEqual(set(passed), set(['test1'])) 747 self.assertEqual(set(passed), set(['test1']))
750 self.assertEqual(set(failed), set(['test2/a', 'test2/d'])) 748 self.assertEqual(set(failed), set(['test2/a', 'test2/d']))
751 self.assertEqual(set(skipped), set(['test2/b'])) 749 self.assertEqual(set(skipped), set(['test2/b']))
OLDNEW
« no previous file with comments | « appengine/chromium_try_flakes/.expect_tests.cfg ('k') | appengine/chromium_try_flakes/status/test/cq_status_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698