Merge pull request #246 from arutk/pyocf_recovery

pytest: basic cache recovery test
This commit is contained in:
Robert Bałdyga 2019-08-29 15:09:05 +02:00 committed by GitHub
commit 17626eee36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -104,6 +104,11 @@ class Volume(Structure):
self.reset_stats()
self.opened = False
def get_copy(self):
new_volume = Volume(self.size)
memmove(new_volume.data, self.data, self.size)
return new_volume
@classmethod
def get_props(cls):
if not cls.props:

View File

@ -72,3 +72,15 @@ def test_load_cache(pyocf_ctx):
cache.stop()
cache = Cache.load_from_device(cache_device)
def test_load_cache_recovery(pyocf_ctx):
cache_device = Volume(S.from_MiB(30))
cache = Cache.start_on_device(cache_device)
device_copy = cache_device.get_copy()
cache.stop()
cache = Cache.load_from_device(device_copy)