[Zodb-checkins] CVS: Packages/ZEO - Cache.py:1.1.2.2

jeremy@digicool.com jeremy@digicool.com
Tue, 8 May 2001 16:45:36 -0400 (EDT)


Update of /cvs-repository/Packages/ZEO/tests
In directory korak:/tmp/cvs-serv13114/tests

Modified Files:
      Tag: ZEO-ZRPC-Dev
	Cache.py 
Log Message:
Add two new tests to check abortVersion() and commitVersion() cache
invalidation.  Separate transactionalUndo() test into separate class,
since some storages do not support it, but do support abortVersion().



--- Updated File Cache.py in package Packages/ZEO --
--- Cache.py	2001/05/02 21:54:12	1.1.2.1
+++ Cache.py	2001/05/08 20:45:35	1.1.2.2
@@ -1,9 +1,10 @@
 """Tests of the ZEO cache"""
 
+from ZODB.Transaction import Transaction
 from ZODB.tests.MinPO import MinPO
 from ZODB.tests.StorageTestBase import zodb_unpickle
 
-class StorageWithCache:
+class TransUndoStorageWithCache:
 
     def checkUndoInvalidation(self):
         oid = self._storage.new_oid()
@@ -31,8 +32,35 @@
         obj = zodb_unpickle(data)
         assert obj == MinPO(24)
 
+class StorageWithCache:
+
     def checkAbortVersionInvalidation(self):
-        pass
+        oid = self._storage.new_oid()
+        revid = self._dostore(oid, data=MinPO(1))
+        revid = self._dostore(oid, revid=revid, data=MinPO(2))
+        revid = self._dostore(oid, revid=revid, data=MinPO(3), version="foo")
+        revid = self._dostore(oid, revid=revid, data=MinPO(4), version="foo")
+        t = Transaction()
+        self._storage.tpc_begin(t)
+        self._storage.abortVersion("foo", t)
+        self._storage.load(oid, "foo")
+        self._storage.tpc_vote(t)
+        self._storage.tpc_finish(t)
+        data, revid = self._storage.load(oid, "foo")
+        obj = zodb_unpickle(data)
+        assert obj == MinPO(2), obj
 
     def checkCommitVersionInvalidation(self):
-        pass
+        oid = self._storage.new_oid()
+        revid = self._dostore(oid, data=MinPO(1))
+        revid = self._dostore(oid, revid=revid, data=MinPO(2))
+        revid = self._dostore(oid, revid=revid, data=MinPO(3), version="foo")
+        t = Transaction()
+        self._storage.tpc_begin(t)
+        self._storage.commitVersion("foo", "", t)
+        self._storage.load(oid, "")
+        self._storage.tpc_vote(t)
+        self._storage.tpc_finish(t)
+        data, revid = self._storage.load(oid, "")
+        obj = zodb_unpickle(data)
+        assert obj == MinPO(3), obj