예제 #1
0
 def test_load_using_checkpoint1_miss(self):
     from relstorage.tests.fakecache import data
     adapter = MockAdapter()
     c = self.getClass()(adapter, MockOptionsWithFakeCache(), 'myprefix')
     c.current_tid = 60
     c.checkpoints = (50, 40)
     adapter.mover.data[2] = (b'123', 35)
     res = c.load(None, 2)
     self.assertEqual(res, (b'123', 35))
     self.assertEqual(data.get('myprefix:state:50:2'), p64(35) + b'123')
예제 #2
0
 def test_load_using_checkpoint1_miss(self):
     from relstorage.tests.fakecache import data
     from ZODB.utils import p64
     adapter = MockAdapter()
     c = self.getClass()(adapter, MockOptionsWithFakeCache())
     c.current_tid = 60
     c.checkpoints = (50, 40)
     adapter.mover.data[2] = ('123', 35)
     res = c.load(None, 2)
     self.assertEqual(res, ('123', 35))
     self.assertEqual(data.get('myprefix:state:50:2'), p64(35) + '123')
예제 #3
0
 def test_load_using_checkpoint1_hit(self):
     from relstorage.tests.fakecache import data
     from ZODB.utils import p64
     adapter = MockAdapter()
     c = self.getClass()(adapter, MockOptionsWithFakeCache())
     c.current_tid = 60
     c.checkpoints = (50, 40)
     data['myprefix:state:40:2'] = p64(35) + '123'
     res = c.load(None, 2)
     self.assertEqual(res, ('123', 35))
     self.assertEqual(data.get('myprefix:state:50:2'), p64(35) + '123')
예제 #4
0
 def test_load_using_checkpoint0_miss(self):
     from relstorage.tests.fakecache import data
     from ZODB.utils import p64
     adapter = MockAdapter()
     c = self.getClass()(adapter, MockOptionsWithFakeCache())
     c.current_tid = 60
     c.checkpoints = (50, 40)
     adapter.mover.data[2] = ('xyz', 45)
     res = c.load(None, 2)
     self.assertEqual(res, ('xyz', 45))
     self.assertEqual(data.get('myprefix:state:50:2'), p64(45) + 'xyz')
예제 #5
0
 def test_load_using_delta_after1_hit(self):
     from relstorage.tests.fakecache import data
     adapter = MockAdapter()
     c = self.getClass()(adapter, MockOptionsWithFakeCache(), 'myprefix')
     c.current_tid = 60
     c.checkpoints = (50, 40)
     c.delta_after1[2] = 45
     data['myprefix:state:45:2'] = p64(45) + b'abc'
     res = c.load(None, 2)
     self.assertEqual(res, (b'abc', 45))
     self.assertEqual(data.get('myprefix:state:50:2'), p64(45) + b'abc')
예제 #6
0
 def test_load_using_delta_after1_hit(self):
     from relstorage.tests.fakecache import data
     from ZODB.utils import p64
     adapter = MockAdapter()
     c = self.getClass()(adapter, MockOptionsWithFakeCache())
     c.current_tid = 60
     c.checkpoints = (50, 40)
     c.delta_after1[2] = 45
     data['myprefix:state:45:2'] = p64(45) + 'abc'
     res = c.load(None, 2)
     self.assertEqual(res, ('abc', 45))
     self.assertEqual(data.get('myprefix:state:50:2'), p64(45) + 'abc')