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

Unified Diff: appengine/findit/waterfall/test/waterfall_config_test.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, 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 side-by-side diff with in-line comments
Download patch
Index: appengine/findit/waterfall/test/waterfall_config_test.py
diff --git a/appengine/findit/waterfall/test/waterfall_config_test.py b/appengine/findit/waterfall/test/waterfall_config_test.py
index 1e4d53e18318fad640967670151737992d6cc11f..da22e30f29fdbd523d385e8398d25b8574bb57dc 100644
--- a/appengine/findit/waterfall/test/waterfall_config_test.py
+++ b/appengine/findit/waterfall/test/waterfall_config_test.py
@@ -2,67 +2,11 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-from testing_utils import testing
-
-from model.wf_config import FinditConfig
from waterfall import waterfall_config
+from waterfall.test import wf_configured_test_case
-class MastersTest(testing.AppengineTestCase):
-
- def setUp(self):
- super(MastersTest, self).setUp()
- self.mock_current_user(user_email='test@chromium.org', is_admin=True)
-
- config_data = {
- 'steps_for_masters_rules': {
- 'supported_masters': {
- 'master1': {
- # supported_steps override global.
- 'supported_steps': ['step6'],
- 'unsupported_steps': ['step1', 'step2', 'step3'],
- },
- 'master2': {
- # Only supports step4 and step5 regardless of global.
- 'supported_steps': ['step4', 'step5'],
- 'check_global': False
- },
- 'master3': {
- # Supports everything not blacklisted in global.
- },
- },
- 'global': {
- # Blacklists all listed steps for all masters unless overridden.
- 'unsupported_steps': ['step6', 'step7'],
- }
- },
- 'builders_to_trybots': {
- 'master1': {
- 'builder1': {
- 'mastername': 'tryserver1',
- 'buildername': 'trybot1',
- 'strict_regex': True,
- }
- }
- },
- 'try_job_settings': {
- 'server_query_interval_seconds': 60,
- 'job_timeout_hours': 5,
- 'allowed_response_error_times': 1
- },
- 'swarming_settings': {
- 'server_host': 'chromium-swarm.appspot.com',
- 'default_request_priority': 150,
- 'request_expiration_hours': 20,
- 'server_query_interval_seconds': 60,
- 'task_timeout_hours': 23,
- 'isolated_server': 'https://isolateserver.appspot.com',
- 'isolated_storage_url': 'isolateserver.storage.googleapis.com',
- 'iterations_to_rerun': 10
- }
- }
-
- FinditConfig.Get().Update(**config_data)
+class MastersTest(wf_configured_test_case.WaterfallTestCase):
def testConvertOldMastersFormatToNew(self):
self.assertEqual(
@@ -79,7 +23,6 @@ class MastersTest(testing.AppengineTestCase):
{
'master1': ['1', '2'],
'master2': {}
-
}))
def testGetStepsForMastersRulesWithSettingsProvided(self):
@@ -95,7 +38,8 @@ class MastersTest(testing.AppengineTestCase):
def testStepIsSupportedForMaster(self):
self.assertFalse(
- waterfall_config.StepIsSupportedForMaster('step1', 'master1'))
+ waterfall_config.StepIsSupportedForMaster('unsupported_step1',
+ 'master1'))
self.assertTrue(
waterfall_config.StepIsSupportedForMaster('step4', 'master1'))
self.assertTrue(
@@ -111,15 +55,20 @@ class MastersTest(testing.AppengineTestCase):
self.assertTrue(
waterfall_config.StepIsSupportedForMaster('step5', 'master2'))
self.assertFalse(
- waterfall_config.StepIsSupportedForMaster('step7', 'master2'))
+ waterfall_config.StepIsSupportedForMaster('unsupported_step7',
+ 'master2'))
self.assertTrue(
- waterfall_config.StepIsSupportedForMaster('step6', 'master1'))
+ waterfall_config.StepIsSupportedForMaster('unsupported_step6',
+ 'master1'))
self.assertFalse(
- waterfall_config.StepIsSupportedForMaster('step6', 'master2'))
+ waterfall_config.StepIsSupportedForMaster('unsupported_step6',
+ 'master2'))
self.assertFalse(
- waterfall_config.StepIsSupportedForMaster('step6', 'master3'))
+ waterfall_config.StepIsSupportedForMaster('unsupported_step6',
+ 'master3'))
self.assertFalse(
- waterfall_config.StepIsSupportedForMaster('step7', 'master3'))
+ waterfall_config.StepIsSupportedForMaster('unsupported_step7',
+ 'master3'))
def testGetTrybotForWaterfallBuilder(self):
self.assertEqual(
@@ -134,7 +83,7 @@ class MastersTest(testing.AppengineTestCase):
{
'server_query_interval_seconds': 60,
'job_timeout_hours': 5,
- 'allowed_response_error_times': 1
+ 'allowed_response_error_times': 5
},
waterfall_config.GetTryJobSettings())

Powered by Google App Engine
This is Rietveld 408576698