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

jeremy@digicool.com jeremy@digicool.com
Wed, 2 May 2001 17:54:13 -0400 (EDT)


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

Added Files:
      Tag: ZEO-ZRPC-Dev
	Cache.py 
Log Message:
Single test that shows error with cache invalidation and transactional
undo



--- Added File Cache.py in package Packages/ZEO ---
"""Tests of the ZEO cache"""

from ZODB.tests.MinPO import MinPO
from ZODB.tests.StorageTestBase import zodb_unpickle

class StorageWithCache:

    def checkUndoInvalidation(self):
        oid = self._storage.new_oid()
        revid = self._dostore(oid, data=MinPO(23))
        revid = self._dostore(oid, revid=revid, data=MinPO(24))
        revid = self._dostore(oid, revid=revid, data=MinPO(25))

        info = self._storage.undoInfo()
        tid = info[0]['id']
        # Now start an undo transaction
        self._transaction.note('undo1')
        self._storage.tpc_begin(self._transaction)

        oids = self._storage.transactionalUndo(tid, self._transaction)

        # Make sure this doesn't load invalid data into the cache
        self._storage.load(oid, '')
        
        self._storage.tpc_vote(self._transaction)
        self._storage.tpc_finish(self._transaction)

        assert len(oids) == 1
        assert oids[0] == oid
        data, revid = self._storage.load(oid, '')
        obj = zodb_unpickle(data)
        assert obj == MinPO(24)

    def checkAbortVersionInvalidation(self):
        pass

    def checkCommitVersionInvalidation(self):
        pass