Commit 3d09f75e authored by Kirill Smelkov's avatar Kirill Smelkov

fixup! Fix loadBefore vs GC

Make sure that loadBefore actually uses ._conflict_cache data
parent 7099fd12
...@@ -19,6 +19,7 @@ from ZODB.tests import BasicStorage ...@@ -19,6 +19,7 @@ from ZODB.tests import BasicStorage
from ZODB.tests import Synchronization from ZODB.tests import Synchronization
from ZODB.tests import ConflictResolution from ZODB.tests import ConflictResolution
from ZODB.tests import MTStorage from ZODB.tests import MTStorage
from ZODB.utils import p64, u64
def handle_all_serials(oid, *args): def handle_all_serials(oid, *args):
...@@ -188,6 +189,11 @@ class TemporaryStorageTests(unittest.TestCase): ...@@ -188,6 +189,11 @@ class TemporaryStorageTests(unittest.TestCase):
def assertCacheKeys(*voidrevOK): def assertCacheKeys(*voidrevOK):
oidrevOK = set(voidrevOK) oidrevOK = set(voidrevOK)
self.assertEqual(set(storage._conflict_cache.keys()), oidrevOK) self.assertEqual(set(storage._conflict_cache.keys()), oidrevOK)
# make sure that loadBefore actually uses ._conflict_cache data
for (oid, rev) in voidrevOK:
load_data, load_serial, _ = storage.loadBefore(oid, p64(u64(rev)+1))
data, t = storage._conflict_cache[(oid, rev)]
self.assertEqual((load_data, load_serial), (data, rev))
oid1 = storage.new_oid() oid1 = storage.new_oid()
self._dostore(storage, oid1, data=MinPO(5)) self._dostore(storage, oid1, data=MinPO(5))
......
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