Commit 6e89b1e0 authored by Jeremy Hylton's avatar Jeremy Hylton

Improve checkTransactionalUndoIterator test.

Make sure that the test undoes an object creation and make sure that
the iterator for that transaction return None for the data attribute.
parent 0a1ede2d
...@@ -75,11 +75,13 @@ class IteratorStorage(IteratorCompare): ...@@ -75,11 +75,13 @@ class IteratorStorage(IteratorCompare):
return return
oid = self._storage.new_oid() oid = self._storage.new_oid()
revid = self._dostore(oid) revid = self._dostore(oid, data=MinPO(23))
self._dostore(oid, revid) revid = self._dostore(oid, revid=revid, data=MinPO(24))
revid = self._dostore(oid, revid=revid, data=MinPO(25))
self.undoLastTrans() self.undoTrans(0)
self.undoLastTrans() self.undoTrans(2)
self.undoTrans(4)
# XXX extend these checks. right now, just iterating with CVS # XXX extend these checks. right now, just iterating with CVS
# FS or Berkeley will fail here, but once fixed we should # FS or Berkeley will fail here, but once fixed we should
...@@ -89,9 +91,16 @@ class IteratorStorage(IteratorCompare): ...@@ -89,9 +91,16 @@ class IteratorStorage(IteratorCompare):
for data in trans: for data in trans:
pass pass
def undoLastTrans(self): # The last transaction performed an undo of the transaction
# that created object oid. (As Barry points out, the object
# is now in the George Bailey state.) Assert that the final
# data record contains None in the data attribute.
self.assertEqual(data.oid, oid)
self.assertEqual(data.data, None)
def undoTrans(self, i):
info = self._storage.undoInfo() info = self._storage.undoInfo()
tid = info[0]['id'] tid = info[i]['id']
t = Transaction() t = Transaction()
self._storage.tpc_begin(t) self._storage.tpc_begin(t)
oids = self._storage.transactionalUndo(tid, t) oids = self._storage.transactionalUndo(tid, t)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment