Merge "Add a test for a broken config on startup" into feature/zuulv3
This commit is contained in:
commit
7c1fca2a8a
|
@ -1370,14 +1370,14 @@ class ZuulTestCase(BaseTestCase):
|
|||
self.rpc = zuul.rpclistener.RPCListener(self.config, self.sched)
|
||||
|
||||
self.sched.start()
|
||||
self.sched.reconfigure(self.config)
|
||||
self.sched.resume()
|
||||
self.webapp.start()
|
||||
self.rpc.start()
|
||||
self.launch_client.gearman.waitForServer()
|
||||
|
||||
self.addCleanup(self.shutdown)
|
||||
|
||||
self.sched.reconfigure(self.config)
|
||||
self.sched.resume()
|
||||
|
||||
def tearDown(self):
|
||||
super(ZuulTestCase, self).tearDown()
|
||||
self.assertFinalState()
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
- pipeline:
|
||||
name: check
|
||||
manager: independent
|
||||
source:
|
||||
gerrit
|
||||
trigger:
|
||||
gerrit:
|
||||
- event: patchset-created
|
||||
success:
|
||||
gerrit:
|
||||
verified: 1
|
||||
failure:
|
||||
gerrit:
|
||||
verified: -1
|
||||
|
||||
- project:
|
||||
error: true
|
|
@ -0,0 +1,6 @@
|
|||
- tenant:
|
||||
name: tenant-one
|
||||
source:
|
||||
gerrit:
|
||||
config-repos:
|
||||
- common-config
|
|
@ -39,7 +39,11 @@ def handle_repo(path):
|
|||
if os.path.exists(os.path.join(path, fn)):
|
||||
config_path = os.path.join(path, fn)
|
||||
break
|
||||
config = yaml.safe_load(open(config_path))
|
||||
try:
|
||||
config = yaml.safe_load(open(config_path))
|
||||
except Exception:
|
||||
print(" Has yaml errors")
|
||||
return
|
||||
for block in config:
|
||||
if 'job' not in block:
|
||||
continue
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
import os
|
||||
import textwrap
|
||||
|
||||
import testtools
|
||||
|
||||
import zuul.configloader
|
||||
from tests.base import AnsibleZuulTestCase, ZuulTestCase
|
||||
|
||||
|
||||
|
@ -282,3 +285,19 @@ class TestAnsible(AnsibleZuulTestCase):
|
|||
bare_role_flag_path = os.path.join(self.test_root,
|
||||
build.uuid + '.bare-role.flag')
|
||||
self.assertTrue(os.path.exists(bare_role_flag_path))
|
||||
|
||||
|
||||
class TestBrokenConfig(ZuulTestCase):
|
||||
# Test that we get an appropriate syntax error if we start with a
|
||||
# broken config.
|
||||
|
||||
tenant_config_file = 'config/broken/main.yaml'
|
||||
|
||||
def setUp(self):
|
||||
with testtools.ExpectedException(
|
||||
zuul.configloader.ConfigurationSyntaxError,
|
||||
"\nZuul encountered a syntax error"):
|
||||
super(TestBrokenConfig, self).setUp()
|
||||
|
||||
def test_broken_config_on_startup(self):
|
||||
pass
|
||||
|
|
Loading…
Reference in New Issue