Allow extra time for initial ZooKeeper connection

We see some random ZK test failures in the pipelines. I believe
this may be because we just aren't waiting long enough for the ZK
process to start up. The kazoo client defaults to waiting only 10
seconds. This change increases the first connection attempt to wait
60 seconds.

Change-Id: I7801166f1a99e1641222e91ef7fc76aad3b6f104
This commit is contained in:
David Shrewsbury 2016-08-05 09:44:33 -04:00
parent 3a3ba723d5
commit 3c8bfe5e82

View File

@ -547,9 +547,13 @@ class ZKTestCase(BaseTestCase):
rand_test_path = '%s_%s' % (random_bits, os.getpid())
self.chroot_path = "/nodepool_test/%s" % rand_test_path
# Ensure the chroot path exists and clean up an pre-existing znodes
# Ensure the chroot path exists and clean up an pre-existing znodes.
# Allow extra time for the very first connection because we might
# be waiting for the ZooKeeper server to be started from the
# ZookeeperServerFixture fixture.
_tmp_client = kazoo.client.KazooClient(
hosts='%s:%s' % (self.zookeeper_host, self.zookeeper_port))
hosts='%s:%s' % (self.zookeeper_host, self.zookeeper_port),
timeout=60)
_tmp_client.start()
if _tmp_client.exists(self.chroot_path):