Expose timeout capabilities and use them for tests
Change-Id: I5b6ee43e6a6b91859dacedb9791da74e247cd12b
This commit is contained in:
@@ -50,6 +50,13 @@ class Characteristics(enum.Enum):
|
|||||||
"""Coordinator components when used by multiple **hosts** work
|
"""Coordinator components when used by multiple **hosts** work
|
||||||
the same as if those components were only used by a single thread."""
|
the same as if those components were only used by a single thread."""
|
||||||
|
|
||||||
|
NON_TIMEOUT_BASED = 'NON_TIMEOUT_BASED'
|
||||||
|
"""The driver has the following property:
|
||||||
|
|
||||||
|
* Its operations are not based on the timeout of other clients, but on some
|
||||||
|
other more robust mechanisms.
|
||||||
|
"""
|
||||||
|
|
||||||
LINEARIZABLE = 'LINEARIZABLE'
|
LINEARIZABLE = 'LINEARIZABLE'
|
||||||
"""The driver has the following properties:
|
"""The driver has the following properties:
|
||||||
|
|
||||||
|
|||||||
@@ -205,6 +205,7 @@ class FileDriver(coordination._RunWatchersMixin,
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
CHARACTERISTICS = (
|
CHARACTERISTICS = (
|
||||||
|
coordination.Characteristics.NON_TIMEOUT_BASED,
|
||||||
coordination.Characteristics.DISTRIBUTED_ACROSS_THREADS,
|
coordination.Characteristics.DISTRIBUTED_ACROSS_THREADS,
|
||||||
coordination.Characteristics.DISTRIBUTED_ACROSS_PROCESSES,
|
coordination.Characteristics.DISTRIBUTED_ACROSS_PROCESSES,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ class IPCDriver(coordination.CoordinationDriver):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
CHARACTERISTICS = (
|
CHARACTERISTICS = (
|
||||||
|
coordination.Characteristics.NON_TIMEOUT_BASED,
|
||||||
coordination.Characteristics.DISTRIBUTED_ACROSS_THREADS,
|
coordination.Characteristics.DISTRIBUTED_ACROSS_THREADS,
|
||||||
coordination.Characteristics.DISTRIBUTED_ACROSS_PROCESSES,
|
coordination.Characteristics.DISTRIBUTED_ACROSS_PROCESSES,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ class MySQLDriver(coordination.CoordinationDriver):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
CHARACTERISTICS = (
|
CHARACTERISTICS = (
|
||||||
|
coordination.Characteristics.NON_TIMEOUT_BASED,
|
||||||
coordination.Characteristics.DISTRIBUTED_ACROSS_THREADS,
|
coordination.Characteristics.DISTRIBUTED_ACROSS_THREADS,
|
||||||
coordination.Characteristics.DISTRIBUTED_ACROSS_PROCESSES,
|
coordination.Characteristics.DISTRIBUTED_ACROSS_PROCESSES,
|
||||||
coordination.Characteristics.DISTRIBUTED_ACROSS_HOSTS,
|
coordination.Characteristics.DISTRIBUTED_ACROSS_HOSTS,
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ class PostgresDriver(coordination.CoordinationDriver):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
CHARACTERISTICS = (
|
CHARACTERISTICS = (
|
||||||
|
coordination.Characteristics.NON_TIMEOUT_BASED,
|
||||||
coordination.Characteristics.DISTRIBUTED_ACROSS_THREADS,
|
coordination.Characteristics.DISTRIBUTED_ACROSS_THREADS,
|
||||||
coordination.Characteristics.DISTRIBUTED_ACROSS_PROCESSES,
|
coordination.Characteristics.DISTRIBUTED_ACROSS_PROCESSES,
|
||||||
coordination.Characteristics.DISTRIBUTED_ACROSS_HOSTS,
|
coordination.Characteristics.DISTRIBUTED_ACROSS_HOSTS,
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class ZakeDriver(zookeeper.KazooDriver):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
CHARACTERISTICS = (
|
CHARACTERISTICS = (
|
||||||
|
coordination.Characteristics.NON_TIMEOUT_BASED,
|
||||||
coordination.Characteristics.DISTRIBUTED_ACROSS_THREADS,
|
coordination.Characteristics.DISTRIBUTED_ACROSS_THREADS,
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -435,6 +435,7 @@ class KazooDriver(BaseZooKeeperDriver):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
CHARACTERISTICS = (
|
CHARACTERISTICS = (
|
||||||
|
coordination.Characteristics.NON_TIMEOUT_BASED,
|
||||||
coordination.Characteristics.DISTRIBUTED_ACROSS_THREADS,
|
coordination.Characteristics.DISTRIBUTED_ACROSS_THREADS,
|
||||||
coordination.Characteristics.DISTRIBUTED_ACROSS_PROCESSES,
|
coordination.Characteristics.DISTRIBUTED_ACROSS_PROCESSES,
|
||||||
coordination.Characteristics.DISTRIBUTED_ACROSS_HOSTS,
|
coordination.Characteristics.DISTRIBUTED_ACROSS_HOSTS,
|
||||||
|
|||||||
@@ -47,13 +47,11 @@ class TestAPI(testscenarios.TestWithScenarios,
|
|||||||
'bad_url': 'kazoo://localhost:1'}),
|
'bad_url': 'kazoo://localhost:1'}),
|
||||||
('zake', {'url': 'zake://?timeout=5'}),
|
('zake', {'url': 'zake://?timeout=5'}),
|
||||||
('memcached', {'url': os.getenv("TOOZ_TEST_MEMCACHED_URL"),
|
('memcached', {'url': os.getenv("TOOZ_TEST_MEMCACHED_URL"),
|
||||||
'bad_url': 'memcached://localhost:1',
|
'bad_url': 'memcached://localhost:1'}),
|
||||||
'timeout_capable': True}),
|
|
||||||
('ipc', {'url': 'ipc://'}),
|
('ipc', {'url': 'ipc://'}),
|
||||||
('file', {'url': 'file:///tmp'}),
|
('file', {'url': 'file:///tmp'}),
|
||||||
('redis', {'url': os.getenv("TOOZ_TEST_REDIS_URL"),
|
('redis', {'url': os.getenv("TOOZ_TEST_REDIS_URL"),
|
||||||
'bad_url': 'redis://localhost:1',
|
'bad_url': 'redis://localhost:1'}),
|
||||||
'timeout_capable': True}),
|
|
||||||
('postgresql', {'url': os.getenv("TOOZ_TEST_POSTGRESQL_URL"),
|
('postgresql', {'url': os.getenv("TOOZ_TEST_POSTGRESQL_URL"),
|
||||||
'bad_url': 'postgresql://localhost:1'}),
|
'bad_url': 'postgresql://localhost:1'}),
|
||||||
('mysql', {'url': os.getenv("TOOZ_TEST_MYSQL_URL"),
|
('mysql', {'url': os.getenv("TOOZ_TEST_MYSQL_URL"),
|
||||||
@@ -377,8 +375,9 @@ class TestAPI(testscenarios.TestWithScenarios,
|
|||||||
self.assertTrue(member_id_test2 not in members_ids)
|
self.assertTrue(member_id_test2 not in members_ids)
|
||||||
|
|
||||||
def test_timeout(self):
|
def test_timeout(self):
|
||||||
if not getattr(self, "timeout_capable", False):
|
if (tooz.coordination.Characteristics.NON_TIMEOUT_BASED
|
||||||
self.skipTest("This test only works with timeout capable drivers")
|
in self._coord.CHARACTERISTICS):
|
||||||
|
self.skipTest("This driver is not based on timeout")
|
||||||
self._coord.stop()
|
self._coord.stop()
|
||||||
if "?" in self.url:
|
if "?" in self.url:
|
||||||
sep = "&"
|
sep = "&"
|
||||||
|
|||||||
Reference in New Issue
Block a user