[Zodb-checkins] CVS: ZODB3/ZEO/tests - testZEO.py:1.75.2.4
CommitLockTests.py:1.15.2.3
Jeremy Hylton
cvs-admin at zope.org
Sun Nov 23 15:54:48 EST 2003
Update of /cvs-repository/ZODB3/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv30908/ZEO/tests
Modified Files:
Tag: ZODB3-mvcc-2-branch
testZEO.py CommitLockTests.py
Log Message:
Divide CommitLock test into two parts -- Vote and Undo.
MappingStorage only supports the vote tests.
=== ZODB3/ZEO/tests/testZEO.py 1.75.2.3 => 1.75.2.4 ===
--- ZODB3/ZEO/tests/testZEO.py:1.75.2.3 Wed Nov 19 10:46:50 2003
+++ ZODB3/ZEO/tests/testZEO.py Sun Nov 23 15:54:47 2003
@@ -106,7 +106,7 @@
MTStorage.MTStorage,
ReadOnlyStorage.ReadOnlyStorage,
# ZEO test mixin classes (in the same order as imported)
- CommitLockTests.CommitLockTests,
+ CommitLockTests.CommitLockVoteTests,
ThreadTests.ThreadTests,
# Locally defined (see above)
MiscZEOTests
@@ -163,6 +163,7 @@
GenericTests,
Cache.StorageWithCache,
Cache.TransUndoStorageWithCache,
+ CommitLockTests.CommitLockUndoTests,
ConflictResolution.ConflictResolvingStorage,
ConflictResolution.ConflictResolvingTransUndoStorage,
RevisionStorage.RevisionStorage,
=== ZODB3/ZEO/tests/CommitLockTests.py 1.15.2.2 => 1.15.2.3 ===
--- ZODB3/ZEO/tests/CommitLockTests.py:1.15.2.2 Sat Nov 22 23:54:08 2003
+++ ZODB3/ZEO/tests/CommitLockTests.py Sun Nov 23 15:54:47 2003
@@ -103,6 +103,51 @@
self._storage.store(oid, ZERO, zodb_pickle(MinPO(1)), '', txn)
return oid, txn
+ def _begin_threads(self):
+ # Start a second transaction on a different connection without
+ # blocking the test thread. Returns only after each thread has
+ # set it's ready event.
+ self._storages = []
+ self._threads = []
+
+ for i in range(self.NUM_CLIENTS):
+ storage = self._duplicate_client()
+ txn = Transaction()
+ tid = self._get_timestamp()
+
+ t = WorkerThread(self, storage, txn)
+ self._threads.append(t)
+ t.start()
+ t.ready.wait()
+
+ # Close on the connections abnormally to test server response
+ if i == 0:
+ storage.close()
+ else:
+ self._storages.append((storage, txn))
+
+ def _finish_threads(self):
+ for t in self._threads:
+ t.cleanup()
+
+ def _duplicate_client(self):
+ "Open another ClientStorage to the same server."
+ # XXX argh it's hard to find the actual address
+ # The rpc mgr addr attribute is a list. Each element in the
+ # list is a socket domain (AF_INET, AF_UNIX, etc.) and an
+ # address.
+ addr = self._storage._addr
+ new = ZEO.ClientStorage.ClientStorage(addr, wait=1)
+ new.registerDB(DummyDB(), None)
+ return new
+
+ def _get_timestamp(self):
+ t = time.time()
+ t = TimeStamp(*time.gmtime(t)[:5]+(t%60,))
+ return `t`
+
+class CommitLockVoteTests(CommitLockTests):
+
def checkCommitLockVoteFinish(self):
oid, txn = self._start_txn()
self._storage.tpc_vote(txn)
@@ -141,6 +186,8 @@
self._finish_threads()
self._cleanup()
+class CommitLockUndoTests(CommitLockTests):
+
def _get_trans_id(self):
self._dostore()
L = self._storage.undoInfo()
@@ -200,46 +247,3 @@
self._finish_threads()
self._cleanup()
-
- def _begin_threads(self):
- # Start a second transaction on a different connection without
- # blocking the test thread. Returns only after each thread has
- # set it's ready event.
- self._storages = []
- self._threads = []
-
- for i in range(self.NUM_CLIENTS):
- storage = self._duplicate_client()
- txn = Transaction()
- tid = self._get_timestamp()
-
- t = WorkerThread(self, storage, txn)
- self._threads.append(t)
- t.start()
- t.ready.wait()
-
- # Close on the connections abnormally to test server response
- if i == 0:
- storage.close()
- else:
- self._storages.append((storage, txn))
-
- def _finish_threads(self):
- for t in self._threads:
- t.cleanup()
-
- def _duplicate_client(self):
- "Open another ClientStorage to the same server."
- # XXX argh it's hard to find the actual address
- # The rpc mgr addr attribute is a list. Each element in the
- # list is a socket domain (AF_INET, AF_UNIX, etc.) and an
- # address.
- addr = self._storage._addr
- new = ZEO.ClientStorage.ClientStorage(addr, wait=1)
- new.registerDB(DummyDB(), None)
- return new
-
- def _get_timestamp(self):
- t = time.time()
- t = TimeStamp(*time.gmtime(t)[:5]+(t%60,))
- return `t`
More information about the Zodb-checkins
mailing list