diff --git a/tests/functional/pyocf/types/volume.py b/tests/functional/pyocf/types/volume.py index 9fbf063..4bca10b 100644 --- a/tests/functional/pyocf/types/volume.py +++ b/tests/functional/pyocf/types/volume.py @@ -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: diff --git a/tests/functional/tests/basic/test_pyocf.py b/tests/functional/tests/basic/test_pyocf.py index c012d85..b881abd 100644 --- a/tests/functional/tests/basic/test_pyocf.py +++ b/tests/functional/tests/basic/test_pyocf.py @@ -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)