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

Side by Side Diff: appengine/findit/waterfall/test/wf_configured_test_case.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 testing_utils import testing
6
7 from model.wf_config import FinditConfig
8
9
10 _DEFAULT_STEPS_FOR_MASTERS_RULES = {
11 'supported_masters': {
12 'm': {
13 'check_global': True
14 },
15 'm3': {
16 'check_global': True
17 },
18 'master1': {
19 # supported_steps override global.
20 'supported_steps': ['step6'],
21 'unsupported_steps': ['unsupported_step1',
22 'unsupported_step2',
23 'unsupported_step3'],
24 'check_global': True
25 },
26 'master2': {
27 # Only supports step4 and step5 regardless of global.
28 'supported_steps': ['step4', 'step5'],
29 'check_global': False
30 },
31 'master3': {
32 # Supports everything not blacklisted in global.
33 'check_global': True
34 },
35 },
36 'global': {
37 # Blacklists all listed steps for all masters unless overridden.
38 'unsupported_steps': ['step6', 'step7'],
39 }
40 }
41
42
43 _DEFAULT_TRY_BOT_MAPPING = {
44 'master1': {
45 'builder1': {
46 'mastername': 'tryserver1',
47 'buildername': 'trybot1',
48 'strict_regex': True,
49 }
50 },
51 'm': {
52 'b': {
53 'mastername': 'tryserver.master',
54 'buildername': 'tryserver.builder',
55 }
56 }
57 }
58
59
60 _DEFAULT_TRY_JOB_SETTINGS = {
61 'server_query_interval_seconds': 60,
62 'job_timeout_hours': 5,
63 'allowed_response_error_times': 5
64 }
65
66
67 _DEFAULT_SWARMING_SETTINGS = {
68 'server_host': 'chromium-swarm.appspot.com',
69 'default_request_priority': 150,
70 'request_expiration_hours': 20,
71 'server_query_interval_seconds': 60,
72 'task_timeout_hours': 23,
73 'isolated_server': 'https://isolateserver.appspot.com',
74 'isolated_storage_url': 'isolateserver.storage.googleapis.com',
75 'iterations_to_rerun': 10
76 }
77
78
79 DEFAULT_UNIT_TEST_CONFIG_DATA = {
80 'steps_for_masters_rules': _DEFAULT_STEPS_FOR_MASTERS_RULES,
81 'builders_to_trybots': _DEFAULT_TRY_BOT_MAPPING,
82 'try_job_settings': _DEFAULT_TRY_JOB_SETTINGS,
83 'swarming_settings': _DEFAULT_SWARMING_SETTINGS
84 }
85
86
87 def MockConfigSettings(config_data=None): # pragma: no cover.
88 """Sets up Findit's config for unit tests.
89
90 Args:
91 config_data: a dict containing the config Findit should use for unit tests.
92 If None, then a default config is used.
93 """
94
95 if config_data is None:
96 FinditConfig.Get().Update(**DEFAULT_UNIT_TEST_CONFIG_DATA)
97 else:
98 FinditConfig.Get().Update(**config_data)
99
100
101 class WaterfallConfiguredTestCase(testing.AppengineTestCase):
stgao 2016/03/31 18:07:13 nit: WaterfallConfiguredTestCase --> WaterfallTest
lijeffrey 2016/03/31 22:50:20 Done.
102
103 def setUp(self): # pragma: no cover.
104 super(WaterfallConfiguredTestCase, self).setUp()
105 self.mock_current_user(user_email='test@chromium.org', is_admin=True)
106 MockConfigSettings()
107 self.mock_current_user()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698