Commit 4dfdf05a authored by Julien Muchembled's avatar Julien Muchembled

tests: an expected failure was actually due to a misuse of undo API

Obviously, oids can't be automatically invalidated if the undo is done directly
at the storage level.

In commit 9cca0f8e, only 1 bug was found.
parent 920484d7
...@@ -23,6 +23,7 @@ from thread import get_ident ...@@ -23,6 +23,7 @@ from thread import get_ident
from zlib import compress from zlib import compress
from persistent import Persistent, GHOST from persistent import Persistent, GHOST
from ZODB import DB, POSException from ZODB import DB, POSException
from ZODB.DB import TransactionalUndo
from neo.storage.transactions import TransactionManager, \ from neo.storage.transactions import TransactionManager, \
DelayedError, ConflictError DelayedError, ConflictError
from neo.lib.connection import MTClientConnection from neo.lib.connection import MTClientConnection
...@@ -169,22 +170,20 @@ class Test(NEOThreadedTest): ...@@ -169,22 +170,20 @@ class Test(NEOThreadedTest):
t.commit() t.commit()
ob.value += 1 ob.value += 1
t.commit() t.commit()
tid = ob._p_serial undo = TransactionalUndo(cluster.db, (ob._p_serial,))
storage = cluster.db.storage
txn = transaction.Transaction() txn = transaction.Transaction()
storage.tpc_begin(txn) undo.tpc_begin(txn)
if conflict_during_store: if conflict_during_store:
with Patch(cluster.client, waitResponses=waitResponses) as p: with Patch(cluster.client, waitResponses=waitResponses) as p:
storage.undo(tid, txn) undo.commit(txn)
else: else:
ob.value += 3 ob.value += 3
t.commit() t.commit()
storage.undo(tid, txn) undo.commit(txn)
storage.tpc_finish(txn) undo.tpc_vote(txn)
value = ob.value undo.tpc_finish(txn)
ob._p_invalidate() # BUG: this should not be required t.begin()
self.assertEqual(ob.value, 3) self.assertEqual(ob.value, 3)
expectedFailure(self.assertNotEqual)(value, 4)
finally: finally:
cluster.stop() cluster.stop()
......
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