Merge "Cache empty branch config to prevent spurious reconfig"
This commit is contained in:
commit
2fd688352f
|
@ -244,6 +244,18 @@ class TestTenantGroups4(TenantParserTestCase):
|
|||
cat_jobs = [job for job in self.gearman_server.jobs_history
|
||||
if job.name == b'merger:cat']
|
||||
self.assertEqual(1, len(cat_jobs))
|
||||
old_layout = tenant.layout
|
||||
|
||||
# Check that creating a change in project1 doesn't cause a
|
||||
# reconfiguration (due to a mistaken belief that we need to
|
||||
# load config from it since there is none in memory).
|
||||
A = self.fake_gerrit.addFakeChange('org/project1', 'master', 'A')
|
||||
self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
|
||||
self.waitUntilSettled()
|
||||
tenant = self.sched.abide.tenants.get('tenant-one')
|
||||
new_layout = tenant.layout
|
||||
|
||||
self.assertEqual(old_layout, new_layout)
|
||||
|
||||
|
||||
class TestTenantGroups5(TenantParserTestCase):
|
||||
|
|
|
@ -1542,10 +1542,6 @@ class TenantParser(object):
|
|||
for project in itertools.chain(
|
||||
tenant.config_projects, tenant.untrusted_projects):
|
||||
tpc = tenant.project_configs[project.canonical_name]
|
||||
# If all config classes are excluded then do not request
|
||||
# any getFiles jobs.
|
||||
if not tpc.load_classes:
|
||||
continue
|
||||
# For each branch in the repo, get the zuul.yaml for that
|
||||
# branch. Remember the branch and then implicitly add a
|
||||
# branch selector to each job there. This makes the
|
||||
|
@ -1556,6 +1552,14 @@ class TenantParser(object):
|
|||
branch):
|
||||
# We already have this branch cached.
|
||||
continue
|
||||
if not tpc.load_classes:
|
||||
# If all config classes are excluded then do not
|
||||
# request any getFiles jobs, but cache the lack of
|
||||
# data so we know we've looked at this branch.
|
||||
abide.cacheUnparsedConfig(
|
||||
project.canonical_name,
|
||||
branch, model.UnparsedConfig())
|
||||
continue
|
||||
job = self.merger.getFiles(
|
||||
project.source.connection.connection_name,
|
||||
project.name, branch,
|
||||
|
|
Loading…
Reference in New Issue