diff --git a/tests/functional/pyocf/types/cache.py b/tests/functional/pyocf/types/cache.py index eedd278..c6d5118 100644 --- a/tests/functional/pyocf/types/cache.py +++ b/tests/functional/pyocf/types/cache.py @@ -1,5 +1,6 @@ # # Copyright(c) 2019-2022 Intel Corporation +# Copyright(c) 2024 Huawei Technologies # SPDX-License-Identifier: BSD-3-Clause # @@ -677,7 +678,7 @@ class Cache: self.device = None if c.results["error"]: - raise OcfError("Attaching cache device failed", c.results["error"]) + raise OcfError("Detaching cache device failed", c.results["error"]) def load_cache(self, device, open_cores=True, disable_cleaner=False): self.device = device diff --git a/tests/functional/tests/management/test_attach_cache.py b/tests/functional/tests/management/test_attach_cache.py index 4f294c0..5ad3d38 100644 --- a/tests/functional/tests/management/test_attach_cache.py +++ b/tests/functional/tests/management/test_attach_cache.py @@ -63,6 +63,18 @@ def test_attach_cache_twice(pyocf_ctx): cache.stop() +def test_detach_cache_twice(pyocf_ctx): + cache_device = RamVolume(Size.from_MiB(50)) + cache = Cache.start_on_device(cache_device) + + cache.detach_device() + + with pytest.raises(OcfError, match="Detaching cache device failed"): + cache.detach_device() + + cache.stop() + + @pytest.mark.parametrize("cls", CacheLineSize) @pytest.mark.parametrize("mode", [CacheMode.WB, CacheMode.WT, CacheMode.WO]) @pytest.mark.parametrize("new_cache_size", [80, 120])