Scope tests fixes
Signed-off-by: klapinsk <katarzyna.lapinska@intel.com>
This commit is contained in:
@@ -145,7 +145,12 @@ def test_ioclass_directory_file_operations(filesystem):
|
||||
Udev.disable()
|
||||
|
||||
with TestRun.step("Create and load IO class config file."):
|
||||
ioclass_id = random.randint(1, ioclass_config.MAX_IO_CLASS_ID)
|
||||
ioclass_id = random.randint(2, ioclass_config.MAX_IO_CLASS_ID)
|
||||
ioclass_config.add_ioclass(ioclass_id=1,
|
||||
eviction_priority=1,
|
||||
allocation="1.00",
|
||||
rule="metadata",
|
||||
ioclass_config_path=ioclass_config_path)
|
||||
# directory IO class
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=ioclass_id,
|
||||
@@ -441,4 +446,4 @@ def check_occupancy(expected: Size, actual: Size):
|
||||
|
||||
|
||||
def ioclass_is_enabled(cache, ioclass_id: int):
|
||||
return [i["allocation"] for i in cache.list_io_classes() if i["id"] == ioclass_id].pop() > 0.00
|
||||
return [float(i.allocation) for i in cache.list_io_classes() if i.id == ioclass_id].pop() > 0.00
|
||||
|
||||
@@ -155,13 +155,13 @@ def test_ioclass_occuppancy_load(cache_line_size):
|
||||
f"{len(ioclass_list_after_load)}"
|
||||
)
|
||||
|
||||
original_sorted = sorted(original_ioclass_list, key=lambda k: k["id"])
|
||||
loaded_sorted = sorted(ioclass_list_after_load, key=lambda k: k["id"])
|
||||
original_sorted = sorted(original_ioclass_list, key=lambda k: k.id)
|
||||
loaded_sorted = sorted(ioclass_list_after_load, key=lambda k: k.id)
|
||||
|
||||
for original, loaded in zip(original_sorted, loaded_sorted):
|
||||
original_allocation = original["allocation"]
|
||||
loaded_allocation = loaded["allocation"]
|
||||
ioclass_id = original["id"]
|
||||
original_allocation = original.allocation
|
||||
loaded_allocation = loaded.allocation
|
||||
ioclass_id = original.id
|
||||
if original_allocation != loaded_allocation:
|
||||
TestRun.LOGGER.error(
|
||||
f"Occupancy limit doesn't match for ioclass {ioclass_id}: "
|
||||
|
||||
@@ -68,6 +68,13 @@ def test_ioclass_repart(cache_mode, cache_line_size, ioclass_size_multiplicatior
|
||||
|
||||
with TestRun.step("Add default ioclasses"):
|
||||
ioclass_config.add_ioclass(*str(IoClass.default(allocation="1.00")).split(","))
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=5,
|
||||
rule="metadata",
|
||||
eviction_priority=1,
|
||||
allocation="1.00",
|
||||
ioclass_config_path=ioclass_config_path
|
||||
)
|
||||
|
||||
with TestRun.step("Add ioclasses for all dirs"):
|
||||
for io_class in io_classes:
|
||||
@@ -116,7 +123,7 @@ def test_ioclass_repart(cache_mode, cache_line_size, ioclass_size_multiplicatior
|
||||
actuall_occupancy = get_io_class_occupancy(cache, io_class.id)
|
||||
|
||||
occupancy_limit = (
|
||||
(io_class.max_occupancy * cache_size * ioclass_size_multiplicatior)
|
||||
(io_class.max_occupancy * cache_size)
|
||||
.align_down(Unit.Blocks4096.get_value())
|
||||
.set_unit(Unit.Blocks4096)
|
||||
)
|
||||
|
||||
@@ -21,7 +21,7 @@ from recordclass import recordclass
|
||||
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||
@pytest.mark.require_disk("core", DiskTypeLowerThan("cache"))
|
||||
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||
@pytest.mark.parametrize("new_occupancy", [0, 20, 70, 100])
|
||||
@pytest.mark.parametrize("new_occupancy", [25, 50, 70, 100])
|
||||
def test_ioclass_resize(cache_line_size, new_occupancy):
|
||||
"""
|
||||
title: Resize ioclass
|
||||
@@ -46,17 +46,25 @@ def test_ioclass_resize(cache_line_size, new_occupancy):
|
||||
|
||||
with TestRun.step("Prepare test dirs"):
|
||||
IoclassConfig = recordclass("IoclassConfig", "id eviction_prio max_occupancy dir_path")
|
||||
io_class = IoclassConfig(1, 3, 0.50, f"{mountpoint}/A")
|
||||
io_class = IoclassConfig(2, 3, 0.10, f"{mountpoint}/A")
|
||||
|
||||
fs_utils.create_directory(io_class.dir_path, parents=True)
|
||||
fs_utils.create_directory(io_class.dir_path, parents=True)
|
||||
|
||||
with TestRun.step("Remove old ioclass config"):
|
||||
ioclass_config.remove_ioclass_config()
|
||||
ioclass_config.create_ioclass_config(False)
|
||||
|
||||
with TestRun.step("Add default ioclasses"):
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=1,
|
||||
rule="metadata&done",
|
||||
eviction_priority=1,
|
||||
allocation="1.00",
|
||||
ioclass_config_path=ioclass_config_path
|
||||
)
|
||||
ioclass_config.add_ioclass(*str(IoClass.default(allocation="0.00")).split(","))
|
||||
|
||||
|
||||
with TestRun.step("Add directory for ioclass"):
|
||||
ioclass_config.add_ioclass(
|
||||
io_class.id,
|
||||
@@ -91,7 +99,8 @@ def test_ioclass_resize(cache_line_size, new_occupancy):
|
||||
.set_unit(Unit.Blocks4096)
|
||||
)
|
||||
|
||||
if actuall_occupancy > occupancy_limit:
|
||||
# Divergency may be casued be rounding max occupancy
|
||||
if actuall_occupancy > occupancy_limit + Size(100, Unit.Blocks4096):
|
||||
TestRun.LOGGER.error(
|
||||
f"Occupancy for ioclass id exceeded: {io_class.id}. "
|
||||
f"Limit: {occupancy_limit}, actuall: {actuall_occupancy}"
|
||||
@@ -106,6 +115,13 @@ def test_ioclass_resize(cache_line_size, new_occupancy):
|
||||
|
||||
ioclass_config.add_ioclass(*str(IoClass.default(allocation="0.00")).split(","))
|
||||
|
||||
ioclass_config.add_ioclass(
|
||||
ioclass_id=1,
|
||||
rule="metadata&done",
|
||||
eviction_priority=1,
|
||||
allocation="1.00",
|
||||
ioclass_config_path=ioclass_config_path
|
||||
)
|
||||
ioclass_config.add_ioclass(
|
||||
io_class.id,
|
||||
f"directory:{io_class.dir_path}&done",
|
||||
|
||||
Reference in New Issue
Block a user