Update more ZooKeeperClient timeouts in tests
A recent change updated some uses of the ZooKeeperClient to use a consistent, and more generous, timeout, in order to reduce the number of incidents of racy test failures. There are several more places where we construct a client object which could benefit from the same change. This commit updates the remaining instances. Change-Id: Ia7b7fc491779145fdf71449e4caa6c331553a937
This commit is contained in:
parent
8048330fff
commit
707c7d1305
@ -20,7 +20,10 @@ import subprocess
|
||||
from zuul.driver.sql import SQLDriver
|
||||
from zuul.zk import ZooKeeperClient
|
||||
from tests.base import (
|
||||
BaseTestCase, MySQLSchemaFixture, PostgresqlSchemaFixture
|
||||
BaseTestCase,
|
||||
MySQLSchemaFixture,
|
||||
PostgresqlSchemaFixture,
|
||||
ZOOKEEPER_SESSION_TIMEOUT,
|
||||
)
|
||||
|
||||
import sqlalchemy
|
||||
@ -36,7 +39,8 @@ class DBBaseTestCase(BaseTestCase):
|
||||
self.zk_chroot_fixture.zk_hosts,
|
||||
tls_cert=self.zk_chroot_fixture.zookeeper_cert,
|
||||
tls_key=self.zk_chroot_fixture.zookeeper_key,
|
||||
tls_ca=self.zk_chroot_fixture.zookeeper_ca
|
||||
tls_ca=self.zk_chroot_fixture.zookeeper_ca,
|
||||
timeout=ZOOKEEPER_SESSION_TIMEOUT,
|
||||
)
|
||||
self.addCleanup(self.zk_client.disconnect)
|
||||
self.zk_client.connect()
|
||||
|
@ -26,7 +26,11 @@ from zuul.zk.components import (
|
||||
ComponentRegistry, COMPONENT_REGISTRY
|
||||
)
|
||||
|
||||
from tests.base import BaseTestCase, iterate_timeout
|
||||
from tests.base import (
|
||||
BaseTestCase,
|
||||
iterate_timeout,
|
||||
ZOOKEEPER_SESSION_TIMEOUT,
|
||||
)
|
||||
|
||||
|
||||
class EventQueueBaseTestCase(BaseTestCase):
|
||||
@ -39,7 +43,8 @@ class EventQueueBaseTestCase(BaseTestCase):
|
||||
self.zk_chroot_fixture.zk_hosts,
|
||||
tls_cert=self.zk_chroot_fixture.zookeeper_cert,
|
||||
tls_key=self.zk_chroot_fixture.zookeeper_key,
|
||||
tls_ca=self.zk_chroot_fixture.zookeeper_ca
|
||||
tls_ca=self.zk_chroot_fixture.zookeeper_ca,
|
||||
timeout=ZOOKEEPER_SESSION_TIMEOUT,
|
||||
)
|
||||
self.addCleanup(self.zk_client.disconnect)
|
||||
self.zk_client.connect()
|
||||
@ -461,7 +466,9 @@ class TestManagementEventQueue(EventQueueBaseTestCase):
|
||||
self.zk_chroot_fixture.zk_hosts,
|
||||
tls_cert=self.zk_chroot_fixture.zookeeper_cert,
|
||||
tls_key=self.zk_chroot_fixture.zookeeper_key,
|
||||
tls_ca=self.zk_chroot_fixture.zookeeper_ca)
|
||||
tls_ca=self.zk_chroot_fixture.zookeeper_ca,
|
||||
timeout=ZOOKEEPER_SESSION_TIMEOUT,
|
||||
)
|
||||
self.addCleanup(external_client.disconnect)
|
||||
external_client.connect()
|
||||
|
||||
@ -502,7 +509,9 @@ class TestManagementEventQueue(EventQueueBaseTestCase):
|
||||
self.zk_chroot_fixture.zk_hosts,
|
||||
tls_cert=self.zk_chroot_fixture.zookeeper_cert,
|
||||
tls_key=self.zk_chroot_fixture.zookeeper_key,
|
||||
tls_ca=self.zk_chroot_fixture.zookeeper_ca)
|
||||
tls_ca=self.zk_chroot_fixture.zookeeper_ca,
|
||||
timeout=ZOOKEEPER_SESSION_TIMEOUT,
|
||||
)
|
||||
self.addCleanup(external_client.disconnect)
|
||||
external_client.connect()
|
||||
|
||||
|
@ -25,6 +25,7 @@ from tests.base import (
|
||||
simple_layout,
|
||||
iterate_timeout,
|
||||
model_version,
|
||||
ZOOKEEPER_SESSION_TIMEOUT,
|
||||
)
|
||||
from zuul.zk import ZooKeeperClient
|
||||
from zuul.zk.branch_cache import BranchCache, BranchFlag
|
||||
@ -215,7 +216,9 @@ class TestBranchCacheUpgrade(BaseTestCase):
|
||||
self.zk_chroot_fixture.zk_hosts,
|
||||
tls_cert=self.zk_chroot_fixture.zookeeper_cert,
|
||||
tls_key=self.zk_chroot_fixture.zookeeper_key,
|
||||
tls_ca=self.zk_chroot_fixture.zookeeper_ca)
|
||||
tls_ca=self.zk_chroot_fixture.zookeeper_ca,
|
||||
timeout=ZOOKEEPER_SESSION_TIMEOUT,
|
||||
)
|
||||
self.addCleanup(self.zk_client.disconnect)
|
||||
self.zk_client.connect()
|
||||
self.model_test_component_info = SchedulerComponent(
|
||||
|
@ -17,7 +17,12 @@ import uuid
|
||||
from zuul import model
|
||||
import zuul.nodepool
|
||||
|
||||
from tests.base import BaseTestCase, FakeNodepool, iterate_timeout
|
||||
from tests.base import (
|
||||
BaseTestCase,
|
||||
FakeNodepool,
|
||||
iterate_timeout,
|
||||
ZOOKEEPER_SESSION_TIMEOUT,
|
||||
)
|
||||
from zuul.zk import ZooKeeperClient
|
||||
from zuul.zk.nodepool import ZooKeeperNodepool
|
||||
from zuul.zk.components import COMPONENT_REGISTRY
|
||||
@ -58,7 +63,9 @@ class TestNodepoolBase(BaseTestCase):
|
||||
self.zk_chroot_fixture.zk_hosts,
|
||||
tls_cert=self.zk_chroot_fixture.zookeeper_cert,
|
||||
tls_key=self.zk_chroot_fixture.zookeeper_key,
|
||||
tls_ca=self.zk_chroot_fixture.zookeeper_ca)
|
||||
tls_ca=self.zk_chroot_fixture.zookeeper_ca,
|
||||
timeout=ZOOKEEPER_SESSION_TIMEOUT,
|
||||
)
|
||||
self.zk_nodepool = ZooKeeperNodepool(self.zk_client)
|
||||
self.addCleanup(self.zk_client.disconnect)
|
||||
self.zk_client.connect()
|
||||
|
@ -65,6 +65,7 @@ from tests.base import (
|
||||
HoldableMergerApi,
|
||||
iterate_timeout,
|
||||
model_version,
|
||||
ZOOKEEPER_SESSION_TIMEOUT,
|
||||
)
|
||||
from zuul.zk.zkobject import (
|
||||
ShardedZKObject, PolymorphicZKObjectMixin, ZKObject, ZKContext
|
||||
@ -85,7 +86,9 @@ class ZooKeeperBaseTestCase(BaseTestCase):
|
||||
self.zk_chroot_fixture.zk_hosts,
|
||||
tls_cert=self.zk_chroot_fixture.zookeeper_cert,
|
||||
tls_key=self.zk_chroot_fixture.zookeeper_key,
|
||||
tls_ca=self.zk_chroot_fixture.zookeeper_ca)
|
||||
tls_ca=self.zk_chroot_fixture.zookeeper_ca,
|
||||
timeout=ZOOKEEPER_SESSION_TIMEOUT,
|
||||
)
|
||||
self.addCleanup(self.zk_client.disconnect)
|
||||
self.zk_client.connect()
|
||||
self.setupModelPin()
|
||||
@ -429,6 +432,7 @@ class TestComponentRegistry(ZooKeeperBaseTestCase):
|
||||
tls_cert=self.zk_chroot_fixture.zookeeper_cert,
|
||||
tls_key=self.zk_chroot_fixture.zookeeper_key,
|
||||
tls_ca=self.zk_chroot_fixture.zookeeper_ca,
|
||||
timeout=ZOOKEEPER_SESSION_TIMEOUT,
|
||||
)
|
||||
self.addCleanup(self.second_zk_client.disconnect)
|
||||
self.second_zk_client.connect()
|
||||
|
Loading…
x
Reference in New Issue
Block a user