pyocf: Use bigger cache device size in tests

As amount of fixed size metadata allocated by OCF grows, we need to adjust
test to not try to start cache on device that is too small.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga
2021-12-13 15:57:25 +01:00
parent 99c8c05f3f
commit 98cb9bff70
14 changed files with 82 additions and 82 deletions

View File

@@ -19,7 +19,7 @@ from pyocf.types.shared import OcfError, OcfCompletion, CacheLineSize
@pytest.mark.parametrize("cls", CacheLineSize)
def test_adding_core(pyocf_ctx, cache_mode, cls):
# Start cache device
cache_device = Volume(S.from_MiB(30))
cache_device = Volume(S.from_MiB(50))
cache = Cache.start_on_device(
cache_device, cache_mode=cache_mode, cache_line_size=cls
)
@@ -44,7 +44,7 @@ def test_adding_core(pyocf_ctx, cache_mode, cls):
@pytest.mark.parametrize("cls", CacheLineSize)
def test_removing_core(pyocf_ctx, cache_mode, cls):
# Start cache device
cache_device = Volume(S.from_MiB(30))
cache_device = Volume(S.from_MiB(50))
cache = Cache.start_on_device(
cache_device, cache_mode=cache_mode, cache_line_size=cls
)
@@ -68,7 +68,7 @@ def test_removing_core(pyocf_ctx, cache_mode, cls):
@pytest.mark.parametrize("cls", CacheLineSize)
def test_remove_dirty_no_flush(pyocf_ctx, cache_mode, cls):
# Start cache device
cache_device = Volume(S.from_MiB(30))
cache_device = Volume(S.from_MiB(50))
cache = Cache.start_on_device(
cache_device, cache_mode=cache_mode, cache_line_size=cls
)
@@ -90,7 +90,7 @@ def test_remove_dirty_no_flush(pyocf_ctx, cache_mode, cls):
def test_30add_remove(pyocf_ctx):
# Start cache device
cache_device = Volume(S.from_MiB(30))
cache_device = Volume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device)
# Create core device
@@ -111,7 +111,7 @@ def test_30add_remove(pyocf_ctx):
def test_10add_remove_with_io(pyocf_ctx):
# Start cache device
cache_device = Volume(S.from_MiB(30))
cache_device = Volume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device)
# Create core device
@@ -143,7 +143,7 @@ def test_10add_remove_with_io(pyocf_ctx):
def test_add_remove_30core(pyocf_ctx):
# Start cache device
cache_device = Volume(S.from_MiB(30))
cache_device = Volume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device)
core_devices = []
core_amount = 30
@@ -176,7 +176,7 @@ def test_adding_to_random_cache(pyocf_ctx):
# Create 5 cache devices
for i in range(0, cache_amount):
cache_device = Volume(S.from_MiB(30))
cache_device = Volume(S.from_MiB(50))
cache = Cache.start_on_device(cache_device, name=f"cache{i}")
cache_devices.append(cache)
@@ -202,7 +202,7 @@ def test_adding_to_random_cache(pyocf_ctx):
@pytest.mark.parametrize("cls", CacheLineSize)
def test_adding_core_twice(pyocf_ctx, cache_mode, cls):
# Start cache device
cache_device = Volume(S.from_MiB(30))
cache_device = Volume(S.from_MiB(50))
cache = Cache.start_on_device(
cache_device, cache_mode=cache_mode, cache_line_size=cls
)
@@ -227,13 +227,13 @@ def test_adding_core_twice(pyocf_ctx, cache_mode, cls):
@pytest.mark.parametrize("cls", CacheLineSize)
def test_adding_core_already_used(pyocf_ctx, cache_mode, cls):
# Start first cache device
cache_device1 = Volume(S.from_MiB(30))
cache_device1 = Volume(S.from_MiB(50))
cache1 = Cache.start_on_device(
cache_device1, cache_mode=cache_mode, cache_line_size=cls, name="cache1"
)
# Start second cache device
cache_device2 = Volume(S.from_MiB(30))
cache_device2 = Volume(S.from_MiB(50))
cache2 = Cache.start_on_device(
cache_device2, cache_mode=cache_mode, cache_line_size=cls, name="cache2"
)
@@ -261,7 +261,7 @@ def test_adding_core_already_used(pyocf_ctx, cache_mode, cls):
@pytest.mark.parametrize("cls", CacheLineSize)
def test_add_remove_incrementally(pyocf_ctx, cache_mode, cls):
# Start cache device
cache_device = Volume(S.from_MiB(30))
cache_device = Volume(S.from_MiB(50))
cache = Cache.start_on_device(
cache_device, cache_mode=cache_mode, cache_line_size=cls
)

View File

@@ -35,7 +35,7 @@ logger = logging.getLogger(__name__)
@pytest.mark.parametrize("cls", CacheLineSize)
@pytest.mark.parametrize("mode", [CacheMode.WB, CacheMode.WT, CacheMode.WO])
@pytest.mark.parametrize("new_cache_size", [25, 45])
@pytest.mark.parametrize("new_cache_size", [80, 120])
def test_attach_different_size(
pyocf_ctx, new_cache_size, mode: CacheMode, cls: CacheLineSize
):
@@ -43,7 +43,7 @@ def test_attach_different_size(
attach cache with different size and trigger IO. Verify if occupancy thresold is
respected with both original and new cache device.
"""
cache_device = Volume(Size.from_MiB(35))
cache_device = Volume(Size.from_MiB(100))
core_device = Volume(Size.from_MiB(100))
cache = Cache.start_on_device(cache_device, cache_mode=mode, cache_line_size=cls)
core = Core.using_device(core_device)

View File

@@ -17,7 +17,7 @@ from pyocf.types.shared import CacheLineSize
@pytest.mark.parametrize("cls", CacheLineSize)
def test_change_cache_mode(pyocf_ctx, from_cm, to_cm, cls):
# Start cache device
cache_device = Volume(S.from_MiB(30))
cache_device = Volume(S.from_MiB(50))
cache = Cache.start_on_device(
cache_device, cache_mode=from_cm, cache_line_size=cls
)
@@ -32,7 +32,7 @@ def test_change_cache_mode(pyocf_ctx, from_cm, to_cm, cls):
@pytest.mark.parametrize("cls", CacheLineSize)
def test_change_cleaning_policy(pyocf_ctx, cm, cls):
# Start cache device
cache_device = Volume(S.from_MiB(30))
cache_device = Volume(S.from_MiB(50))
cache = Cache.start_on_device(
cache_device, cache_mode=cm, cache_line_size=cls
)
@@ -57,7 +57,7 @@ def test_change_cleaning_policy(pyocf_ctx, cm, cls):
@pytest.mark.parametrize("cls", CacheLineSize)
def test_cache_change_seq_cut_off_policy(pyocf_ctx, cm, cls):
# Start cache device
cache_device = Volume(S.from_MiB(30))
cache_device = Volume(S.from_MiB(50))
cache = Cache.start_on_device(
cache_device, cache_mode=cm, cache_line_size=cls
)
@@ -96,7 +96,7 @@ def test_cache_change_seq_cut_off_policy(pyocf_ctx, cm, cls):
@pytest.mark.parametrize("cls", CacheLineSize)
def test_core_change_seq_cut_off_policy(pyocf_ctx, cm, cls):
# Start cache device
cache_device = Volume(S.from_MiB(30))
cache_device = Volume(S.from_MiB(50))
cache = Cache.start_on_device(
cache_device, cache_mode=cm, cache_line_size=cls
)

View File

@@ -26,7 +26,7 @@ def test_start_check_default(pyocf_ctx):
"""Test if default values are correct after start.
"""
cache_device = Volume(Size.from_MiB(40))
cache_device = Volume(Size.from_MiB(50))
core_device = Volume(Size.from_MiB(10))
cache = Cache.start_on_device(cache_device)
@@ -50,7 +50,7 @@ def test_start_write_first_and_check_mode(pyocf_ctx, mode: CacheMode, cls: Cache
After start check proper cache mode behaviour, starting with write operation.
"""
cache_device = Volume(Size.from_MiB(40))
cache_device = Volume(Size.from_MiB(50))
core_device = Volume(Size.from_MiB(10))
cache = Cache.start_on_device(cache_device, cache_mode=mode, cache_line_size=cls)
core_exported = Core.using_device(core_device)
@@ -88,7 +88,7 @@ def test_start_read_first_and_check_mode(pyocf_ctx, mode: CacheMode, cls: CacheL
After start check proper cache mode behaviour, starting with read operation.
"""
cache_device = Volume(Size.from_MiB(20))
cache_device = Volume(Size.from_MiB(50))
core_device = Volume(Size.from_MiB(5))
cache = Cache.start_on_device(cache_device, cache_mode=mode, cache_line_size=cls)
core_exported = Core.using_device(core_device)
@@ -131,7 +131,7 @@ def test_start_params(pyocf_ctx, mode: CacheMode, cls: CacheLineSize, layout: Me
Check if cache starts without errors.
If possible check whether cache reports properly set parameters.
"""
cache_device = Volume(Size.from_MiB(20))
cache_device = Volume(Size.from_MiB(50))
queue_size = randrange(60000, 2**32)
unblock_size = randrange(1, queue_size)
volatile_metadata = randrange(2) == 1
@@ -169,7 +169,7 @@ def test_stop(pyocf_ctx, mode: CacheMode, cls: CacheLineSize, with_flush: bool):
Check if cache is stopped properly in different modes with or without preceding flush operation.
"""
cache_device = Volume(Size.from_MiB(20))
cache_device = Volume(Size.from_MiB(50))
core_device = Volume(Size.from_MiB(5))
cache = Cache.start_on_device(cache_device, cache_mode=mode, cache_line_size=cls)
core_exported = Core.using_device(core_device)
@@ -204,7 +204,7 @@ def test_start_stop_multiple(pyocf_ctx):
caches = []
caches_no = randrange(6, 11)
for i in range(1, caches_no):
cache_device = Volume(Size.from_MiB(20))
cache_device = Volume(Size.from_MiB(50))
cache_name = f"cache{i}"
cache_mode = CacheMode(randrange(0, len(CacheMode)))
size = 4096 * 2**randrange(0, len(CacheLineSize))
@@ -236,7 +236,7 @@ def test_100_start_stop(pyocf_ctx):
"""
for i in range(1, 101):
cache_device = Volume(Size.from_MiB(20))
cache_device = Volume(Size.from_MiB(50))
cache_name = f"cache{i}"
cache_mode = CacheMode(randrange(0, len(CacheMode)))
size = 4096 * 2**randrange(0, len(CacheLineSize))
@@ -271,7 +271,7 @@ def test_start_stop_incrementally(pyocf_ctx):
while run:
if add:
for i in range(0, randrange(3, 5) if increase else randrange(1, 3)):
cache_device = Volume(Size.from_MiB(20))
cache_device = Volume(Size.from_MiB(50))
cache_name = f"cache{next(counter)}"
cache_mode = CacheMode(randrange(0, len(CacheMode)))
size = 4096 * 2**randrange(0, len(CacheLineSize))
@@ -311,8 +311,8 @@ def test_start_cache_same_id(pyocf_ctx, mode, cls):
Check that OCF does not allow for 2 caches to be started with the same cache_name
"""
cache_device1 = Volume(Size.from_MiB(20))
cache_device2 = Volume(Size.from_MiB(20))
cache_device1 = Volume(Size.from_MiB(50))
cache_device2 = Volume(Size.from_MiB(50))
cache_name = "cache"
cache = Cache.start_on_device(cache_device1,
cache_mode=mode,
@@ -342,7 +342,7 @@ def test_start_cache_huge_device(pyocf_ctx_log_buffer, cls):
def submit_io(self, io):
io.contents._end(io, 0)
cache_device = HugeDevice(Size.from_MiB(20))
cache_device = HugeDevice(Size.from_MiB(50))
with pytest.raises(OcfError, match="OCF_ERR_INVAL_CACHE_DEV"):
cache = Cache.start_on_device(cache_device, cache_line_size=cls, metadata_volatile=True)
@@ -360,7 +360,7 @@ def test_start_cache_same_device(pyocf_ctx, mode, cls):
Check that OCF does not allow for 2 caches using the same cache device to be started
"""
cache_device = Volume(Size.from_MiB(20))
cache_device = Volume(Size.from_MiB(50))
cache = Cache.start_on_device(
cache_device, cache_mode=mode, cache_line_size=cls, name="cache1"
)