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

Side by Side Diff: appengine/findit/waterfall/test/wf_testcase.py

Issue 1836293002: [Findit] Adding central config test class for unit tests (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Addressing comments Created 4 years, 8 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
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 from google.appengine.api import users
6 from testing_utils import testing
7
8 import copy
9
10 from model.wf_config import FinditConfig
11
12
13 _DEFAULT_STEPS_FOR_MASTERS_RULES = {
14 'supported_masters': {
15 'm': {
16 'check_global': True
17 },
18 'm3': {
19 'check_global': True
20 },
21 'master1': {
22 # supported_steps override global.
23 'supported_steps': ['unsupported_step6'],
24 'unsupported_steps': ['unsupported_step1',
25 'unsupported_step2',
26 'unsupported_step3'],
27 'check_global': True
28 },
29 'master2': {
30 # Only supports step4 and step5 regardless of global.
31 'supported_steps': ['step4', 'step5'],
32 'check_global': False
33 },
34 'master3': {
35 # Supports everything not blacklisted in global.
36 'check_global': True
37 },
38 },
39 'global': {
40 # Blacklists all listed steps for all masters unless overridden.
41 'unsupported_steps': ['unsupported_step6', 'unsupported_step7'],
42 }
43 }
44
45
46 _DEFAULT_TRY_BOT_MAPPING = {
47 'master1': {
48 'builder1': {
49 'mastername': 'tryserver1',
50 'buildername': 'trybot1',
51 'strict_regex': True,
52 }
53 },
54 'm': {
55 'b': {
56 'mastername': 'tryserver.master',
57 'buildername': 'tryserver.builder',
58 }
59 }
60 }
61
62
63 _DEFAULT_TRY_JOB_SETTINGS = {
64 'server_query_interval_seconds': 60,
65 'job_timeout_hours': 5,
66 'allowed_response_error_times': 5
67 }
68
69
70 _DEFAULT_SWARMING_SETTINGS = {
71 'server_host': 'chromium-swarm.appspot.com',
72 'default_request_priority': 150,
73 'request_expiration_hours': 20,
74 'server_query_interval_seconds': 60,
75 'task_timeout_hours': 23,
76 'isolated_server': 'https://isolateserver.appspot.com',
77 'isolated_storage_url': 'isolateserver.storage.googleapis.com',
78 'iterations_to_rerun': 10
79 }
80
81
82 DEFAULT_CONFIG_DATA = {
83 'steps_for_masters_rules': _DEFAULT_STEPS_FOR_MASTERS_RULES,
84 'builders_to_trybots': _DEFAULT_TRY_BOT_MAPPING,
85 'try_job_settings': _DEFAULT_TRY_JOB_SETTINGS,
86 'swarming_settings': _DEFAULT_SWARMING_SETTINGS
87 }
88
89
90 class WaterfallTestCase(testing.AppengineTestCase): # pragma: no cover.
91
92 config_data = DEFAULT_CONFIG_DATA
93
94 def GetCopyOfConfigSettings(self):
95 """Returns a copy of this class instance's config_data."""
96 return copy.deepcopy(self.config_data)
97
98 def UpdateUnitTestConfigSettings(self, config_data=None):
99 """Sets up Findit's config for unit tests."""
100 if config_data:
stgao 2016/04/04 22:07:23 As discussed in person, don't keep a copy of confi
lijeffrey 2016/04/04 23:56:41 Done.
101 self.config_data = config_data
102 else:
103 self.config_data = DEFAULT_CONFIG_DATA
104
105 FinditConfig.Get().Update(user=users.User(email='admin@chromium.org'),
106 is_admin=True, **self.config_data)
107
108 def setUp(self):
109 super(WaterfallTestCase, self).setUp()
110 self.UpdateUnitTestConfigSettings()
111
112
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698