Use random strings for ZK test paths

The getUniqueInteger() does not get a number unique between parallel
test runs, so the chroot path will often conflict between tests unless
run serially. Use something more random by copying what we do from the
MySQL fixture.

Change-Id: Ia716836344813d993fbc2345467695778b0d1789
This commit is contained in:
David Shrewsbury 2016-07-12 19:51:04 -04:00
parent cb32fd47e2
commit 0cf4484eea

View File

@ -521,7 +521,12 @@ class ZKTestCase(BaseTestCase):
self.useFixture(f)
self.zookeeper_host = f.zookeeper_host
self.zookeeper_port = f.zookeeper_port
self.chroot_path = "/nodepool_test/%s" % self.getUniqueInteger()
# Make sure the test chroot paths do not conflict
random_bits = ''.join(random.choice(string.ascii_lowercase +
string.ascii_uppercase)
for x in range(8))
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
_tmp_client = kazoo.client.KazooClient(