Merge "Also cache empty unparsed config"

This commit is contained in:
Zuul 2018-06-16 14:23:32 +00:00 committed by Gerrit Code Review
commit d1c65b28bf
2 changed files with 15 additions and 4 deletions

View File

@ -748,12 +748,24 @@ class TestGithubDriver(ZuulTestCase):
# record previous tenant reconfiguration time, which may not be set
old = self.sched.tenant_last_reconfigured.get('tenant-one', 0)
time.sleep(1)
self.waitUntilSettled()
# clear the gearman jobs history so we can count the cat jobs issued
# during reconfiguration
self.gearman_server.jobs_history.clear()
self.fake_github.emitEvent(pevent)
self.waitUntilSettled()
new = self.sched.tenant_last_reconfigured.get('tenant-one', 0)
# New timestamp should be greater than the old timestamp
self.assertLess(old, new)
# We only expect one cat job here as the (empty) config of org/project
# should be cached.
cat_jobs = [job for job in self.gearman_server.jobs_history
if job.name == b'merger:cat']
self.assertEqual(1, len(cat_jobs))
# TODO(jlk): Make this a more generic test for unknown project
@skip("Skipped for rewrite of webhook handler")
@simple_layout('layouts/basic-github.yaml', driver='github')

View File

@ -1518,13 +1518,12 @@ class TenantParser(object):
self.log.info(
"Loading configuration from %s" %
(source_context,))
project = source_context.project
branch = source_context.branch
incdata = self.loadProjectYAML(
job.files[fn], source_context, loading_errors)
unparsed_config.extend(incdata)
abide.cacheUnparsedConfig(project.canonical_name,
branch, unparsed_config)
abide.cacheUnparsedConfig(
job.source_context.project.canonical_name,
job.source_context.branch, unparsed_config)
def _loadTenantYAML(self, abide, tenant, loading_errors):
config_projects_config = model.UnparsedConfig()