Cleanup zookeeper and fake nodepool in nodepool tests
The nodepool tests set up zookeeper connections and a fake nodepool.
These test resources spawned threads that were leaking and causing
subsequent tests to run with zookeeper and nodepool threads running.
Clean that up.
Change-Id: Ib799d4a40eb51e7bbe71673a082f345235c41019
diff --git a/tests/nodepool/test_nodepool_integration.py b/tests/nodepool/test_nodepool_integration.py
index a0f0498..9c87a10 100644
--- a/tests/nodepool/test_nodepool_integration.py
+++ b/tests/nodepool/test_nodepool_integration.py
@@ -31,6 +31,7 @@
super(TestNodepoolIntegration, self).setUp()
self.zk = zuul.zk.ZooKeeper()
+ self.addCleanup(self.zk.disconnect)
self.zk.connect('localhost:2181')
self.hostname = socket.gethostname()
diff --git a/tests/unit/test_nodepool.py b/tests/unit/test_nodepool.py
index 610c2bc..ba7523c 100644
--- a/tests/unit/test_nodepool.py
+++ b/tests/unit/test_nodepool.py
@@ -37,6 +37,7 @@
self.zk_chroot_fixture.zookeeper_chroot)
self.zk = zuul.zk.ZooKeeper()
+ self.addCleanup(self.zk.disconnect)
self.zk.connect(self.zk_config)
self.hostname = 'nodepool-test-hostname'
@@ -49,6 +50,7 @@
self.zk_chroot_fixture.zookeeper_host,
self.zk_chroot_fixture.zookeeper_port,
self.zk_chroot_fixture.zookeeper_chroot)
+ self.addCleanup(self.fake_nodepool.stop)
def waitForRequests(self):
# Wait until all requests are complete.