Commit 53d15600 authored by Jim Fulton's avatar Jim Fulton

Some tests didn't recognize that when an object hasn't been modified

in a version, we fall back to non-version data.

Undo wasn't tested properly. The tests didn't get the undo ids
from the transaction log.
parent 1f2d5546
......@@ -13,8 +13,10 @@ class TransactionalUndoVersionStorage:
revid_a = self._dostore(oid, data=91)
revid_b = self._dostore(oid, revid=revid_a, data=92, version=version)
revid_c = self._dostore(oid, revid=revid_b, data=93, version=version)
info=self._storage.undoInfo()
tid=info[0]['id']
self._storage.tpc_begin(self._transaction)
oids = self._storage.transactionalUndo(revid_c, self._transaction)
oids = self._storage.transactionalUndo(tid, self._transaction)
self._storage.tpc_vote(self._transaction)
self._storage.tpc_finish(self._transaction)
assert len(oids) == 1
......@@ -32,14 +34,20 @@ class TransactionalUndoVersionStorage:
self._storage.tpc_finish(self._transaction)
assert len(oids) == 1
assert oids[0] == oid
self.assertRaises(POSException.VersionError,
self._storage.load,
oid, version)
#JF# No, because we fall back to non-version data.
#JF# self.assertRaises(POSException.VersionError,
#JF# self._storage.load,
#JF# oid, version)
data, revid = self._storage.load(oid, version)
assert pickle.loads(data) == 92
data, revid = self._storage.load(oid, '')
assert pickle.loads(data) == 92
# ...and undo the commit
info=self._storage.undoInfo()
tid=info[0]['id']
self._storage.tpc_begin(self._transaction)
oids = self._storage.transactionalUndo(revid, self._transaction)
oids = self._storage.transactionalUndo(tid, self._transaction)
self._storage.tpc_vote(self._transaction)
self._storage.tpc_finish(self._transaction)
assert len(oids) == 1
......@@ -57,14 +65,19 @@ class TransactionalUndoVersionStorage:
assert oids[0] == oid
# The object should not exist in the version now, but it should exist
# in the non-version
self.assertRaises(POSException.VersionError,
self._storage.load,
oid, version)
#JF# No, because we fall back
#JF# self.assertRaises(POSException.VersionError,
#JF# self._storage.load,
#JF# oid, version)
data, revid = self._storage.load(oid, version)
assert pickle.loads(data) == 91
data, revid = self._storage.load(oid, '')
assert pickle.loads(data) == 91
# Now undo the abort
info=self._storage.undoInfo()
tid=info[0]['id']
self._storage.tpc_begin(self._transaction)
oids = self._storage.transactionalUndo(revid, self._transaction)
oids = self._storage.transactionalUndo(tid, self._transaction)
self._storage.tpc_vote(self._transaction)
self._storage.tpc_finish(self._transaction)
assert len(oids) == 1
......
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