Skip to content

Commit

Permalink
run pre-defined conflict-resolution tests with client-side conflict r…
Browse files Browse the repository at this point in the history
…esolution
  • Loading branch information
Jim Fulton committed Jul 7, 2016
1 parent 4cdbf8b commit 92e4985
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 25 deletions.
3 changes: 2 additions & 1 deletion src/ZEO/tests/forker.py
Expand Up @@ -33,7 +33,7 @@
class ZEOConfig:
"""Class to generate ZEO configuration file. """

def __init__(self, addr):
def __init__(self, addr, **options):
if isinstance(addr, str):
self.logpath = addr+'.log'
else:
Expand All @@ -42,6 +42,7 @@ def __init__(self, addr):
self.address = addr
self.read_only = None
self.loglevel = 'INFO'
self.__dict__.update(options)

def dump(self, f):
print("<zeo>", file=f)
Expand Down
53 changes: 29 additions & 24 deletions src/ZEO/tests/testZEO.py
Expand Up @@ -143,23 +143,9 @@ def checkVolatileCacheWithImmediateLastTransaction(self):
self.assertNotEquals(ZODB.utils.z64, storage3.lastTransaction())
storage3.close()

class GenericTests(
class GenericTestBase(
# Base class for all ZODB tests
StorageTestBase.StorageTestBase,
# ZODB test mixin classes (in the same order as imported)
BasicStorage.BasicStorage,
PackableStorage.PackableStorage,
Synchronization.SynchronizedStorage,
MTStorage.MTStorage,
ReadOnlyStorage.ReadOnlyStorage,
# ZEO test mixin classes (in the same order as imported)
CommitLockTests.CommitLockVoteTests,
ThreadTests.ThreadTests,
# Locally defined (see above)
MiscZEOTests,
):

"""Combine tests from various origins in one class."""
StorageTestBase.StorageTestBase):

shared_blob_dir = False
blob_cache_dir = None
Expand Down Expand Up @@ -200,14 +186,23 @@ def tearDown(self):
stop()
StorageTestBase.StorageTestBase.tearDown(self)

def runTest(self):
try:
super(GenericTests, self).runTest()
except:
self._failed = True
raise
else:
self._failed = False
class GenericTests(
GenericTestBase,

# ZODB test mixin classes (in the same order as imported)
BasicStorage.BasicStorage,
PackableStorage.PackableStorage,
Synchronization.SynchronizedStorage,
MTStorage.MTStorage,
ReadOnlyStorage.ReadOnlyStorage,
# ZEO test mixin classes (in the same order as imported)
CommitLockTests.CommitLockVoteTests,
ThreadTests.ThreadTests,
# Locally defined (see above)
MiscZEOTests,
):
"""Combine tests from various origins in one class.
"""

def open(self, read_only=0):
# Needed to support ReadOnlyStorage tests. Ought to be a
Expand Down Expand Up @@ -394,7 +389,16 @@ def getConfig(self):
def _wrap_client(self, client):
return ZODB.tests.hexstorage.HexStorage(client)

class ClientConflictResolutionTests(
GenericTestBase,
ConflictResolution.ConflictResolvingStorage,
):

def getConfig(self):
return '<mappingstorage>\n</mappingstorage>\n'

def getZEOConfig(self):
return forker.ZEOConfig(('', 0), client_conflict_resolution=True)

class MappingStorageTests(GenericTests):
"""ZEO backed by a Mapping storage."""
Expand Down Expand Up @@ -1597,6 +1601,7 @@ def test_suite():
"ClientDisconnected"),
)),
))
zeo.addTest(unittest.makeSuite(ClientConflictResolutionTests, 'check'))
zeo.layer = ZODB.tests.util.MininalTestLayer('testZeo-misc')
suite.addTest(zeo)

Expand Down

0 comments on commit 92e4985

Please sign in to comment.