Skip to content

Commit

Permalink
Various test fixes for IMultiCommitStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Fulton committed Jul 2, 2016
1 parent dc26936 commit fd2e2db
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/ZODB/tests/IExternalGC.test
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ transaction ourselves.
>>> storage.deleteObject(oid0, s0, txn)
>>> storage.deleteObject(oid1, s1, txn)
>>> storage.tpc_vote(txn)
>>> storage.tpc_finish(txn)
>>> _ = storage.tpc_finish(txn)
>>> tid = storage.lastTransaction()

Now if we try to load data for the objects, we get a POSKeyError:
Expand Down
7 changes: 6 additions & 1 deletion src/ZODB/tests/TransactionalUndoStorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,12 @@ def _begin_undos_vote(self, t, *tids):
undo_result = self._storage.undo(tid, t)
if undo_result:
oids.extend(undo_result[1])
oids.extend(oid for (oid, _) in self._storage.tpc_vote(t) or ())
v = self._storage.tpc_vote(t)
if v:
if isinstance(v[0], bytes):
oids.extend(v)
else:
oids.extend(oid for (oid, _) in v)
return oids

def undo(self, tid, note):
Expand Down
18 changes: 1 addition & 17 deletions src/ZODB/tests/blob_transaction.txt
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,6 @@ stored are discarded.
... '', t)

>>> serials = blob_storage.tpc_vote(t)
>>> if s1 is None:
... s1 = [s for (oid, s) in serials if oid == blob._p_oid][0]
>>> if s2 is None:
... s2 = [s for (oid, s) in serials if oid == new_oid][0]

>>> blob_storage.tpc_abort(t)

Expand All @@ -402,14 +398,7 @@ Now, the serial for the existing blob should be the same:
>>> blob_storage.load(blob._p_oid, '') == (olddata, oldserial)
True

And we shouldn't be able to read the data that we saved:

>>> blob_storage.loadBlob(blob._p_oid, s1)
Traceback (most recent call last):
...
POSKeyError: 'No blob file at <BLOB STORAGE PATH>'

Of course the old data should be unaffected:
The old data should be unaffected:

>>> with open(blob_storage.loadBlob(blob._p_oid, oldserial)) as fp:
... fp.read()
Expand All @@ -422,11 +411,6 @@ Similarly, the new object wasn't added to the storage:
...
POSKeyError: 0x...

>>> blob_storage.loadBlob(blob._p_oid, s2)
Traceback (most recent call last):
...
POSKeyError: 'No blob file at <BLOB STORAGE PATH>'

.. clean up

>>> tm1.abort()
Expand Down

0 comments on commit fd2e2db

Please sign in to comment.