Test for attaching cache twice
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
This commit is contained in:
parent
58fddd3602
commit
c95f396ba9
@ -27,6 +27,7 @@ from pyocf.types.shared import (
|
|||||||
CacheLines,
|
CacheLines,
|
||||||
CacheLineSize,
|
CacheLineSize,
|
||||||
SeqCutOffPolicy,
|
SeqCutOffPolicy,
|
||||||
|
OcfError,
|
||||||
)
|
)
|
||||||
from pyocf.types.volume import RamVolume
|
from pyocf.types.volume import RamVolume
|
||||||
from pyocf.types.volume_core import CoreVolume
|
from pyocf.types.volume_core import CoreVolume
|
||||||
@ -47,6 +48,21 @@ def test_add_remove_core_detached_cache(pyocf_ctx):
|
|||||||
cache.stop()
|
cache.stop()
|
||||||
|
|
||||||
|
|
||||||
|
def test_attach_cache_twice(pyocf_ctx):
|
||||||
|
cache_device_1 = RamVolume(Size.from_MiB(50))
|
||||||
|
cache_device_2 = RamVolume(Size.from_MiB(50))
|
||||||
|
|
||||||
|
cache = Cache(owner=pyocf_ctx)
|
||||||
|
cache.start_cache()
|
||||||
|
|
||||||
|
cache.attach_device(cache_device_1)
|
||||||
|
|
||||||
|
with pytest.raises(OcfError, match="Attaching cache device failed"):
|
||||||
|
cache.attach_device(cache_device_2)
|
||||||
|
|
||||||
|
cache.stop()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("cls", CacheLineSize)
|
@pytest.mark.parametrize("cls", CacheLineSize)
|
||||||
@pytest.mark.parametrize("mode", [CacheMode.WB, CacheMode.WT, CacheMode.WO])
|
@pytest.mark.parametrize("mode", [CacheMode.WB, CacheMode.WT, CacheMode.WO])
|
||||||
@pytest.mark.parametrize("new_cache_size", [80, 120])
|
@pytest.mark.parametrize("new_cache_size", [80, 120])
|
||||||
|
Loading…
Reference in New Issue
Block a user