Commit e9c789dd authored by Vincent Pelletier's avatar Vincent Pelletier

Trying to commit wrong transaction should raise.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2247 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 98b996b4
...@@ -799,7 +799,8 @@ class Application(object): ...@@ -799,7 +799,8 @@ class Application(object):
def tpc_finish(self, transaction, f=None): def tpc_finish(self, transaction, f=None):
"""Finish current transaction.""" """Finish current transaction."""
if self.local_var.txn is not transaction: if self.local_var.txn is not transaction:
return raise StorageTransactionError('tpc_finish called for wrong'
'transaction')
self._load_lock_acquire() self._load_lock_acquire()
try: try:
tid = self.local_var.tid tid = self.local_var.tid
......
...@@ -672,7 +672,7 @@ class ClientApplicationTests(NeoTestBase): ...@@ -672,7 +672,7 @@ class ClientApplicationTests(NeoTestBase):
self.checkAbortTransaction(conn3) self.checkAbortTransaction(conn3)
def test_tpc_finish1(self): def test_tpc_finish1(self):
# ignore mismatch transaction # transaction mismatch: raise
app = self.getApp() app = self.getApp()
tid = self.makeTID() tid = self.makeTID()
txn = self.makeTransactionObject() txn = self.makeTransactionObject()
...@@ -683,7 +683,7 @@ class ClientApplicationTests(NeoTestBase): ...@@ -683,7 +683,7 @@ class ClientApplicationTests(NeoTestBase):
cell = Mock() cell = Mock()
app.pt = Mock({'getCellListForTID': (cell, cell)}) app.pt = Mock({'getCellListForTID': (cell, cell)})
app.cp = Mock({'getConnForCell': ReturnValues(None, cell)}) app.cp = Mock({'getConnForCell': ReturnValues(None, cell)})
app.tpc_finish(txn) self.assertRaises(StorageTransactionError, app.tpc_finish, txn)
# no packet sent # no packet sent
self.checkNoPacketSent(conn) self.checkNoPacketSent(conn)
self.checkNoPacketSent(app.master_conn) self.checkNoPacketSent(app.master_conn)
......
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