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

Side by Side Diff: appengine/findit/model/test/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: 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.
stgao 2016/03/30 01:06:30 Is there a specific reason we wanted to add this m
lijeffrey 2016/03/30 23:28:34 Moved to Findit/waterfall/test
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': ['step1', 'step2', 'step3'],
22 'check_global': True
23 },
24 'master2': {
25 # Only supports step4 and step5 regardless of global.
26 'supported_steps': ['step4', 'step5'],
27 'check_global': False
28 },
29 'master3': {
30 # Supports everything not blacklisted in global.
31 'check_global': True
32 },
33 },
34 'global': {
35 # Blacklists all listed steps for all masters unless overridden.
36 'unsupported_steps': ['step6', 'step7'],
37 }
38 }
39
40
41 _DEFAULT_TRY_BOT_MAPPING = {
42 'master1': {
43 'builder1': {
44 'mastername': 'tryserver1',
45 'buildername': 'trybot1',
46 'strict_regex': True,
47 }
48 }
49 }
50
51
52 _DEFAULT_TRY_JOB_SETTINGS = {
53 'server_query_interval_seconds': 60,
54 'job_timeout_hours': 5,
55 'allowed_response_error_times': 5
56 }
57
58
59 _DEFAULT_SWARMING_SETTINGS = {
60 'server_host': 'chromium-swarm.appspot.com',
61 'default_request_priority': 150,
62 'request_expiration_hours': 20,
63 'server_query_interval_seconds': 60,
64 'task_timeout_hours': 23,
65 'isolated_server': 'https://isolateserver.appspot.com',
66 'isolated_storage_url': 'isolateserver.storage.googleapis.com',
67 'iterations_to_rerun': 10
68 }
69
70
71 DEFAULT_UNIT_TEST_CONFIG_DATA = {
72 'steps_for_masters_rules': _DEFAULT_STEPS_FOR_MASTERS_RULES,
73 'builders_to_trybots': _DEFAULT_TRY_BOT_MAPPING,
74 'try_job_settings': _DEFAULT_TRY_JOB_SETTINGS,
75 'swarming_settings': _DEFAULT_SWARMING_SETTINGS
76 }
77
78
79 def MockConfigSettings(config_data=None):
80 """Sets up Findit's config for unit tests.
81
82 Args:
83 config_data: a dict containing the config Findit should use for unit tests.
84 If None, then a default config is used.
85 """
86
87 if config_data is None:
88 FinditConfig.Get().Update(**DEFAULT_UNIT_TEST_CONFIG_DATA)
89 else:
90 FinditConfig.Get().Update(**config_data)
91
92
93 class ConfiguredTestCase(testing.AppengineTestCase):
stgao 2016/03/30 01:06:30 Maybe scope this to Waterfall? Later we might need
lijeffrey 2016/03/30 23:28:34 Done.
94
95 def setUp(self):
96 super(ConfiguredTestCase, self).setUp()
97 self.mock_current_user(user_email='test@chromium.org', is_admin=True)
stgao 2016/03/30 01:06:30 If possible, let's not make this default.
lijeffrey 2016/03/30 23:28:34 Done.
98 MockConfigSettings()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698