Merge "Don't fail tenant validation for deprecations"
This commit is contained in:
commit
ac7890010f
|
@ -0,0 +1,21 @@
|
|||
- pipeline:
|
||||
name: gate
|
||||
manager: dependent
|
||||
success-message: Build succeeded (gate).
|
||||
trigger:
|
||||
gerrit:
|
||||
- event: comment-added
|
||||
require-approval:
|
||||
- username: jenkins
|
||||
Verified: 1
|
||||
success:
|
||||
gerrit:
|
||||
Verified: 2
|
||||
submit: true
|
||||
failure:
|
||||
gerrit:
|
||||
Verified: -2
|
||||
start:
|
||||
gerrit:
|
||||
Verified: 0
|
||||
precedence: high
|
|
@ -4811,6 +4811,16 @@ class TestBrokenConfig(ZuulTestCase):
|
|||
"Zuul encountered a syntax error",
|
||||
str(tenant.layout.loading_errors[0].error))
|
||||
|
||||
@simple_layout('layouts/broken-warnings.yaml')
|
||||
def test_broken_config_on_startup_warnings(self):
|
||||
tenant = self.scheds.first.sched.abide.tenants.get('tenant-one')
|
||||
self.assertEquals(
|
||||
len(tenant.layout.loading_errors), 1,
|
||||
"An error should have been stored")
|
||||
self.assertIn(
|
||||
"Zuul encountered a deprecated syntax",
|
||||
str(tenant.layout.loading_errors[0].error))
|
||||
|
||||
def test_dynamic_ignore(self):
|
||||
# Verify dynamic config behaviors inside a tenant broken config
|
||||
tenant = self.scheds.first.sched.abide.tenants.get('tenant-broken')
|
||||
|
@ -5173,6 +5183,23 @@ class TestValidateGood(ZuulTestCase):
|
|||
pass
|
||||
|
||||
|
||||
class TestValidateWarnings(ZuulTestCase):
|
||||
# Test we don't fail when we only have configuration warnings
|
||||
|
||||
validate_tenants = ['tenant-one']
|
||||
tenant_config_file = 'config/broken/main.yaml'
|
||||
|
||||
def setUp(self):
|
||||
with self.assertLogs('zuul.ConfigLoader', level='DEBUG') as full_logs:
|
||||
super().setUp()
|
||||
self.assertRegexInList('Zuul encountered a deprecated syntax',
|
||||
full_logs.output)
|
||||
|
||||
@simple_layout('layouts/broken-warnings.yaml')
|
||||
def test_validate_warnings(self):
|
||||
pass
|
||||
|
||||
|
||||
class RoleTestCase(ZuulTestCase):
|
||||
def _getRolesPaths(self, build, playbook):
|
||||
path = os.path.join(self.jobdir_root, build.uuid,
|
||||
|
|
|
@ -77,6 +77,7 @@ from zuul.model import (
|
|||
SupercedeEvent,
|
||||
SystemAttributes,
|
||||
STATE_FAILED,
|
||||
SEVERITY_WARNING,
|
||||
)
|
||||
from zuul.version import get_version_string
|
||||
from zuul.zk import ZooKeeperClient
|
||||
|
@ -1424,7 +1425,10 @@ class Scheduler(threading.Thread):
|
|||
loading_errors = []
|
||||
for tenant in abide.tenants.values():
|
||||
for error in tenant.layout.loading_errors:
|
||||
loading_errors.append(repr(error))
|
||||
if error.severity == SEVERITY_WARNING:
|
||||
self.log.warning(repr(error))
|
||||
else:
|
||||
loading_errors.append(repr(error))
|
||||
if loading_errors:
|
||||
summary = '\n\n\n'.join(loading_errors)
|
||||
raise configloader.ConfigurationSyntaxError(
|
||||
|
|
Loading…
Reference in New Issue