Refresh pipelines before checking for empty queues

In a multi-scheduler test we can no longer assume that the pipeline
state is up-to-date when checking the final state.

Because of that we refresh the pipelines before checking if all change
queues are empty.

Change-Id: I45265b7360c603c242baeacfd8e14ee31e482bcb
This commit is contained in:
Simon Westphahl
2021-10-25 12:23:43 +02:00
parent f47cf3d6c2
commit 01386dc2cb

View File

@@ -5668,13 +5668,16 @@ class ZuulTestCase(BaseTestCase):
# Make sure there are no orphaned jobs
for tenant in self.scheds.first.sched.abide.tenants.values():
for pipeline in tenant.layout.pipelines.values():
for pipeline_queue in pipeline.queues:
if len(pipeline_queue.queue) != 0:
print('pipeline %s queue %s contents %s' % (
pipeline.name, pipeline_queue.name,
pipeline_queue.queue))
self.assertEqual(len(pipeline_queue.queue), 0,
"Pipelines queues should be empty")
ctx = self.createZKContext()
with pipeline.manager.currentContext(ctx):
pipeline.state.refresh(ctx)
for pipeline_queue in pipeline.queues:
if len(pipeline_queue.queue) != 0:
print('pipeline %s queue %s contents %s' % (
pipeline.name, pipeline_queue.name,
pipeline_queue.queue))
self.assertEqual(len(pipeline_queue.queue), 0,
"Pipelines queues should be empty")
def assertCleanZooKeeper(self):
# Make sure there are no extraneous ZK nodes