Commit 77b49295 authored by Kirill Smelkov's avatar Kirill Smelkov

fixup! Fix loadBefore vs GC

Make sure that loadBefore actually uses ._conflict_cache data
parent 192c535c
...@@ -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
class ZODBProtocolTests(StorageTestBase.StorageTestBase, class ZODBProtocolTests(StorageTestBase.StorageTestBase,
...@@ -144,6 +145,11 @@ class TemporaryStorageTests(unittest.TestCase): ...@@ -144,6 +145,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