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:
parent
cb32fd47e2
commit
0cf4484eea
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user