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

Side by Side Diff: appengine/swarming/test_env_handlers.py

Issue 2534943002: Upload basic info about completed swarming tasks to event_mon (Closed)
Patch Set: fixes Created 4 years 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 | « appengine/swarming/server/task_scheduler_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # coding: utf-8 1 # coding: utf-8
2 # Copyright 2014 The LUCI Authors. All rights reserved. 2 # Copyright 2014 The LUCI Authors. All rights reserved.
3 # Use of this source code is governed under the Apache License, Version 2.0 3 # Use of this source code is governed under the Apache License, Version 2.0
4 # that can be found in the LICENSE file. 4 # that can be found in the LICENSE file.
5 5
6 """Base class for handlers_*_test.py""" 6 """Base class for handlers_*_test.py"""
7 7
8 import base64 8 import base64
9 import json 9 import json
10 import os 10 import os
11 11
12 import test_env 12 import test_env
13 test_env.setup_test_env() 13 test_env.setup_test_env()
14 14
15 from protorpc.remote import protojson 15 from protorpc.remote import protojson
16 import webtest 16 import webtest
17 17
18 import event_mon_metrics
18 import handlers_endpoints 19 import handlers_endpoints
19 import swarming_rpcs 20 import swarming_rpcs
20 from components import auth 21 from components import auth
21 from components import auth_testing 22 from components import auth_testing
22 from components import stats_framework 23 from components import stats_framework
23 import gae_ts_mon 24 import gae_ts_mon
24 from test_support import test_case 25 from test_support import test_case
25 26
26 from server import acl 27 from server import acl
27 from server import large 28 from server import large
28 from server import stats 29 from server import stats
29 30
30 31
31 class AppTestBase(test_case.TestCase): 32 class AppTestBase(test_case.TestCase):
32 APP_DIR = test_env.APP_DIR 33 APP_DIR = test_env.APP_DIR
33 34
34 def setUp(self): 35 def setUp(self):
35 super(AppTestBase, self).setUp() 36 super(AppTestBase, self).setUp()
36 self.bot_version = None 37 self.bot_version = None
37 self.source_ip = '192.168.2.2' 38 self.source_ip = '192.168.2.2'
38 self.testbed.init_user_stub() 39 self.testbed.init_user_stub()
39 40
40 gae_ts_mon.reset_for_unittest(disable=True) 41 gae_ts_mon.reset_for_unittest(disable=True)
42 event_mon_metrics.initialize()
41 43
42 # By default requests in tests are coming from bot with fake IP. 44 # By default requests in tests are coming from bot with fake IP.
43 # WSGI app that implements auth REST API. 45 # WSGI app that implements auth REST API.
44 self.auth_app = webtest.TestApp( 46 self.auth_app = webtest.TestApp(
45 auth.create_wsgi_application(debug=True), 47 auth.create_wsgi_application(debug=True),
46 extra_environ={ 48 extra_environ={
47 'REMOTE_ADDR': self.source_ip, 49 'REMOTE_ADDR': self.source_ip,
48 'SERVER_SOFTWARE': os.environ['SERVER_SOFTWARE'], 50 'SERVER_SOFTWARE': os.environ['SERVER_SOFTWARE'],
49 }) 51 })
50 52
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 259
258 def client_create_task_raw(self, properties=None, **kwargs): 260 def client_create_task_raw(self, properties=None, **kwargs):
259 """Creates a raw command TaskRequest via the Cloud Endpoints API.""" 261 """Creates a raw command TaskRequest via the Cloud Endpoints API."""
260 properties = (properties or {}).copy() 262 properties = (properties or {}).copy()
261 properties['command'] = ['python', 'run_test.py'] 263 properties['command'] = ['python', 'run_test.py']
262 return self._client_create_task(properties, **kwargs) 264 return self._client_create_task(properties, **kwargs)
263 265
264 def client_get_results(self, task_id): 266 def client_get_results(self, task_id):
265 return self.endpoint_call( 267 return self.endpoint_call(
266 handlers_endpoints.SwarmingTaskService, 'result', {'task_id': task_id}) 268 handlers_endpoints.SwarmingTaskService, 'result', {'task_id': task_id})
OLDNEW
« no previous file with comments | « appengine/swarming/server/task_scheduler_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698