Avoid leaking dynamic change queues
On an independent pipeline manager, getChangeQueue dynamically
creates change queues (they are static on dependent pipelines).
It is possible that one might call getChangeQueue() and then
decide not to actually use the change queue which was created.
Rather than asking the programmer to remember to clean up in
that case, make the interface to getChangeQueue() a context
manager so that it is cleaned up automatically.
No existing code-path was found that needed this, but this seems
like a sensible precaution for the future.
Change-Id: Ia2805cdb4d882fafa2decaf00573f657f412d983
diff --git a/tests/base.py b/tests/base.py
index 773f926..afc676b 100755
--- a/tests/base.py
+++ b/tests/base.py
@@ -980,6 +980,10 @@
repos.append(obj)
self.assertEqual(len(repos), 0)
self.assertEmptyQueues()
+ for pipeline in self.sched.layout.pipelines.values():
+ if isinstance(pipeline.manager,
+ zuul.scheduler.IndependentPipelineManager):
+ self.assertEqual(len(pipeline.queues), 0)
def shutdown(self):
self.log.debug("Shutting down after tests")