Fix tests to use new statistics API
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
This commit is contained in:
@@ -72,7 +72,7 @@ def test_ioclass_directory_depth(filesystem):
|
||||
)
|
||||
casadm.load_io_classes(cache_id=cache.cache_id, file=ioclass_config_path)
|
||||
|
||||
base_occupancy = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
base_occupancy = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
TestRun.LOGGER.info("Reading the file in the nested directory")
|
||||
dd = (
|
||||
Dd()
|
||||
@@ -82,7 +82,7 @@ def test_ioclass_directory_depth(filesystem):
|
||||
)
|
||||
dd.run()
|
||||
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
assert new_occupancy == base_occupancy + test_file_1.size, \
|
||||
"Wrong occupancy after reading file!\n" \
|
||||
f"Expected: {base_occupancy + test_file_1.size}, actual: {new_occupancy}"
|
||||
@@ -103,7 +103,7 @@ def test_ioclass_directory_depth(filesystem):
|
||||
drop_caches(DropCachesMode.ALL)
|
||||
test_file_2.refresh_item()
|
||||
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
assert new_occupancy == base_occupancy + test_file_2.size, \
|
||||
"Wrong occupancy after creating file!\n" \
|
||||
f"Expected: {base_occupancy + test_file_2.size}, actual: {new_occupancy}"
|
||||
@@ -122,7 +122,7 @@ def test_ioclass_directory_dir_operations(filesystem):
|
||||
"""
|
||||
def create_files_with_classification_delay_check(directory: Directory, ioclass_id: int):
|
||||
start_time = datetime.now()
|
||||
occupancy_after = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
occupancy_after = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
dd_blocks = 10
|
||||
dd_size = Size(dd_blocks, Unit.Blocks4096)
|
||||
file_counter = 0
|
||||
@@ -135,7 +135,7 @@ def test_ioclass_directory_dir_operations(filesystem):
|
||||
time_from_start = datetime.now() - start_time
|
||||
(Dd().input("/dev/zero").output(file_path).oflag("sync")
|
||||
.block_size(Size(1, Unit.Blocks4096)).count(dd_blocks).run())
|
||||
occupancy_after = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
occupancy_after = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
if occupancy_after - occupancy_before < dd_size:
|
||||
unclassified_files.append(file_path)
|
||||
|
||||
@@ -151,9 +151,9 @@ def test_ioclass_directory_dir_operations(filesystem):
|
||||
def read_files_with_reclassification_check(
|
||||
target_ioclass_id: int, source_ioclass_id: int, directory: Directory, with_delay: bool):
|
||||
start_time = datetime.now()
|
||||
target_occupancy_after = cache.get_cache_statistics(
|
||||
target_occupancy_after = cache.get_statistics_deprecated(
|
||||
io_class_id=target_ioclass_id)["occupancy"]
|
||||
source_occupancy_after = cache.get_cache_statistics(
|
||||
source_occupancy_after = cache.get_statistics_deprecated(
|
||||
io_class_id=source_ioclass_id)["occupancy"]
|
||||
unclassified_files = []
|
||||
|
||||
@@ -163,9 +163,9 @@ def test_ioclass_directory_dir_operations(filesystem):
|
||||
time_from_start = datetime.now() - start_time
|
||||
(Dd().input(file.full_path).output("/dev/null")
|
||||
.block_size(Size(1, Unit.Blocks4096)).run())
|
||||
target_occupancy_after = cache.get_cache_statistics(
|
||||
target_occupancy_after = cache.get_statistics_deprecated(
|
||||
io_class_id=target_ioclass_id)["occupancy"]
|
||||
source_occupancy_after = cache.get_cache_statistics(
|
||||
source_occupancy_after = cache.get_statistics_deprecated(
|
||||
io_class_id=source_ioclass_id)["occupancy"]
|
||||
if target_occupancy_after < target_occupancy_before:
|
||||
pytest.xfail("Target IO class occupancy lowered!")
|
||||
@@ -323,7 +323,7 @@ def test_ioclass_directory_file_operations(filesystem):
|
||||
drop_caches(DropCachesMode.ALL)
|
||||
|
||||
TestRun.LOGGER.info("Creating test file")
|
||||
classified_before = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
classified_before = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
file_path = f"{test_dir_path}/test_file"
|
||||
(Dd().input("/dev/urandom").output(file_path).oflag("sync")
|
||||
.block_size(Size(1, Unit.MebiByte)).count(dd_blocks).run())
|
||||
@@ -332,21 +332,21 @@ def test_ioclass_directory_file_operations(filesystem):
|
||||
test_file = File(file_path).refresh_item()
|
||||
|
||||
TestRun.LOGGER.info("Checking classified occupancy")
|
||||
classified_after = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
classified_after = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
check_occupancy(classified_before + test_file.size, classified_after)
|
||||
|
||||
TestRun.LOGGER.info("Moving test file out of classified directory")
|
||||
classified_before = classified_after
|
||||
non_classified_before = cache.get_cache_statistics(io_class_id=0)["occupancy"]
|
||||
non_classified_before = cache.get_statistics_deprecated(io_class_id=0)["occupancy"]
|
||||
test_file.move(destination=mountpoint)
|
||||
sync()
|
||||
drop_caches(DropCachesMode.ALL)
|
||||
|
||||
TestRun.LOGGER.info("Checking classified occupancy")
|
||||
classified_after = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
classified_after = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
check_occupancy(classified_before, classified_after)
|
||||
TestRun.LOGGER.info("Checking non-classified occupancy")
|
||||
non_classified_after = cache.get_cache_statistics(io_class_id=0)["occupancy"]
|
||||
non_classified_after = cache.get_statistics_deprecated(io_class_id=0)["occupancy"]
|
||||
check_occupancy(non_classified_before, non_classified_after)
|
||||
|
||||
TestRun.LOGGER.info("Reading test file")
|
||||
@@ -356,10 +356,10 @@ def test_ioclass_directory_file_operations(filesystem):
|
||||
.block_size(Size(1, Unit.MebiByte)).run())
|
||||
|
||||
TestRun.LOGGER.info("Checking classified occupancy")
|
||||
classified_after = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
classified_after = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
check_occupancy(classified_before - test_file.size, classified_after)
|
||||
TestRun.LOGGER.info("Checking non-classified occupancy")
|
||||
non_classified_after = cache.get_cache_statistics(io_class_id=0)["occupancy"]
|
||||
non_classified_after = cache.get_statistics_deprecated(io_class_id=0)["occupancy"]
|
||||
check_occupancy(non_classified_before + test_file.size, non_classified_after)
|
||||
|
||||
TestRun.LOGGER.info(f"Moving test file to {nested_dir_path}")
|
||||
@@ -370,10 +370,10 @@ def test_ioclass_directory_file_operations(filesystem):
|
||||
drop_caches(DropCachesMode.ALL)
|
||||
|
||||
TestRun.LOGGER.info("Checking classified occupancy")
|
||||
classified_after = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
classified_after = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
check_occupancy(classified_before, classified_after)
|
||||
TestRun.LOGGER.info("Checking non-classified occupancy")
|
||||
non_classified_after = cache.get_cache_statistics(io_class_id=0)["occupancy"]
|
||||
non_classified_after = cache.get_statistics_deprecated(io_class_id=0)["occupancy"]
|
||||
check_occupancy(non_classified_before, non_classified_after)
|
||||
|
||||
TestRun.LOGGER.info("Reading test file")
|
||||
@@ -383,8 +383,8 @@ def test_ioclass_directory_file_operations(filesystem):
|
||||
.block_size(Size(1, Unit.MebiByte)).run())
|
||||
|
||||
TestRun.LOGGER.info("Checking classified occupancy")
|
||||
classified_after = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
classified_after = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
check_occupancy(classified_before + test_file.size, classified_after)
|
||||
TestRun.LOGGER.info("Checking non-classified occupancy")
|
||||
non_classified_after = cache.get_cache_statistics(io_class_id=0)["occupancy"]
|
||||
non_classified_after = cache.get_statistics_deprecated(io_class_id=0)["occupancy"]
|
||||
check_occupancy(non_classified_before - test_file.size, non_classified_after)
|
||||
|
||||
@@ -56,7 +56,7 @@ def test_ioclass_file_extension():
|
||||
for i in range(iterations):
|
||||
dd.run()
|
||||
sync()
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert stats["dirty"].get_value(Unit.Blocks4096) == (i + 1) * dd_count
|
||||
|
||||
cache.flush_cache()
|
||||
@@ -73,7 +73,7 @@ def test_ioclass_file_extension():
|
||||
)
|
||||
dd.run()
|
||||
sync()
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert stats["dirty"].get_value(Unit.Blocks4096) == 0
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ def test_ioclass_file_extension_preexisting_filesystem():
|
||||
)
|
||||
dd.run()
|
||||
sync()
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert (
|
||||
stats["dirty"].get_value(Unit.Blocks4096)
|
||||
== (extensions.index(ext) + 1) * dd_count
|
||||
@@ -191,7 +191,7 @@ def test_ioclass_file_offset():
|
||||
)
|
||||
dd.run()
|
||||
sync()
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert (
|
||||
stats["dirty"].get_value(Unit.Blocks4096) == 1
|
||||
), f"Offset not cached: {file_offset}"
|
||||
@@ -212,7 +212,7 @@ def test_ioclass_file_offset():
|
||||
)
|
||||
dd.run()
|
||||
sync()
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert (
|
||||
stats["dirty"].get_value(Unit.Blocks4096) == 0
|
||||
), f"Inappropriately cached offset: {file_offset}"
|
||||
@@ -271,10 +271,10 @@ def test_ioclass_file_size(filesystem):
|
||||
TestRun.LOGGER.info("Creating files belonging to different IO classes "
|
||||
"(classification by writes).")
|
||||
for size, ioclass_id in size_to_class.items():
|
||||
occupancy_before = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
occupancy_before = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
file_path = f"{mountpoint}/test_file_{size.get_value()}"
|
||||
Dd().input("/dev/zero").output(file_path).oflag("sync").block_size(size).count(1).run()
|
||||
occupancy_after = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
occupancy_after = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
if occupancy_after != occupancy_before + size:
|
||||
pytest.xfail("File not cached properly!\n"
|
||||
f"Expected {occupancy_before + size}\n"
|
||||
@@ -288,9 +288,9 @@ def test_ioclass_file_size(filesystem):
|
||||
"(classification by reads).")
|
||||
for file in test_files:
|
||||
ioclass_id = size_to_class[file.size]
|
||||
occupancy_before = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
occupancy_before = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
Dd().input(file.full_path).output("/dev/null").block_size(file.size).run()
|
||||
occupancy_after = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
occupancy_after = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
if occupancy_after != occupancy_before + file.size:
|
||||
pytest.xfail("File not reclassified properly!\n"
|
||||
f"Expected {occupancy_before + file.size}\n"
|
||||
@@ -312,10 +312,10 @@ def test_ioclass_file_size(filesystem):
|
||||
ioclass_config_path=ioclass_config_path,
|
||||
)
|
||||
casadm.load_io_classes(cache_id=cache.cache_id, file=ioclass_config_path)
|
||||
occupancy_before = cache.get_cache_statistics(io_class_id=0)["occupancy"]
|
||||
occupancy_before = cache.get_statistics_deprecated(io_class_id=0)["occupancy"]
|
||||
for file in test_files:
|
||||
Dd().input(file.full_path).output("/dev/null").block_size(file.size).run()
|
||||
occupancy_after = cache.get_cache_statistics(io_class_id=0)["occupancy"]
|
||||
occupancy_after = cache.get_statistics_deprecated(io_class_id=0)["occupancy"]
|
||||
if occupancy_after != occupancy_before + file.size:
|
||||
pytest.xfail("File not reclassified properly!\n"
|
||||
f"Expected {occupancy_before + file.size}\n"
|
||||
|
||||
@@ -50,7 +50,7 @@ def test_ioclass_process_name():
|
||||
dd.run()
|
||||
sync()
|
||||
time.sleep(0.1)
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert stats["dirty"].get_value(Unit.Blocks4096) == (i + 1) * dd_count
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ def test_ioclass_pid():
|
||||
f"stdout: {output.stdout} \n stderr :{output.stderr}"
|
||||
)
|
||||
sync()
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert stats["dirty"].get_value(Unit.Blocks4096) == dd_count
|
||||
|
||||
ioclass_config.remove_ioclass(ioclass_id)
|
||||
|
||||
@@ -62,7 +62,7 @@ def test_ioclass_lba():
|
||||
sync()
|
||||
dirty_count += 1
|
||||
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert (
|
||||
stats["dirty"].get_value(Unit.Blocks4096) == dirty_count
|
||||
), f"LBA {lba} not cached"
|
||||
@@ -86,7 +86,7 @@ def test_ioclass_lba():
|
||||
dd.run()
|
||||
sync()
|
||||
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert (
|
||||
stats["dirty"].get_value(Unit.Blocks4096) == 0
|
||||
), f"Inappropriately cached lba: {rand_lba}"
|
||||
@@ -128,7 +128,7 @@ def test_ioclass_request_size():
|
||||
.oflag("direct")
|
||||
)
|
||||
dd.run()
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert (
|
||||
stats["dirty"].get_value(Unit.Blocks4096)
|
||||
== req_size.value / Unit.Blocks4096.value
|
||||
@@ -156,7 +156,7 @@ def test_ioclass_request_size():
|
||||
.oflag("direct")
|
||||
)
|
||||
dd.run()
|
||||
stats = cache.get_cache_statistics(io_class_id=ioclass_id)
|
||||
stats = cache.get_statistics_deprecated(io_class_id=ioclass_id)
|
||||
assert stats["dirty"].get_value(Unit.Blocks4096) == 0
|
||||
|
||||
|
||||
@@ -206,12 +206,12 @@ def test_ioclass_direct(filesystem):
|
||||
else:
|
||||
TestRun.LOGGER.info("Testing on raw exported object")
|
||||
|
||||
base_occupancy = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
base_occupancy = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
|
||||
TestRun.LOGGER.info(f"Buffered writes to {'file' if filesystem else 'device'}")
|
||||
fio.run()
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
assert new_occupancy == base_occupancy, \
|
||||
"Buffered writes were cached!\n" \
|
||||
f"Expected: {base_occupancy}, actual: {new_occupancy}"
|
||||
@@ -220,7 +220,7 @@ def test_ioclass_direct(filesystem):
|
||||
fio.direct()
|
||||
fio.run()
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
assert new_occupancy == base_occupancy + io_size, \
|
||||
"Wrong number of direct writes was cached!\n" \
|
||||
f"Expected: {base_occupancy + io_size}, actual: {new_occupancy}"
|
||||
@@ -230,7 +230,7 @@ def test_ioclass_direct(filesystem):
|
||||
fio.read_write(ReadWrite.read)
|
||||
fio.run()
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
assert new_occupancy == base_occupancy, \
|
||||
"Buffered reads did not cause reclassification!" \
|
||||
f"Expected occupancy: {base_occupancy}, actual: {new_occupancy}"
|
||||
@@ -239,7 +239,7 @@ def test_ioclass_direct(filesystem):
|
||||
fio.direct()
|
||||
fio.run()
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=ioclass_id)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=ioclass_id)["occupancy"]
|
||||
assert new_occupancy == base_occupancy + io_size, \
|
||||
"Wrong number of direct reads was cached!\n" \
|
||||
f"Expected: {base_occupancy + io_size}, actual: {new_occupancy}"
|
||||
@@ -274,7 +274,7 @@ def test_ioclass_metadata(filesystem):
|
||||
core.mount(mountpoint)
|
||||
sync()
|
||||
|
||||
requests_to_metadata_before = cache.get_cache_statistics(
|
||||
requests_to_metadata_before = cache.get_statistics_deprecated(
|
||||
io_class_id=ioclass_id)["write total"]
|
||||
TestRun.LOGGER.info("Creating 20 test files")
|
||||
files = []
|
||||
@@ -292,7 +292,7 @@ def test_ioclass_metadata(filesystem):
|
||||
files.append(File(file_path))
|
||||
|
||||
TestRun.LOGGER.info("Checking requests to metadata")
|
||||
requests_to_metadata_after = cache.get_cache_statistics(
|
||||
requests_to_metadata_after = cache.get_statistics_deprecated(
|
||||
io_class_id=ioclass_id)["write total"]
|
||||
if requests_to_metadata_after == requests_to_metadata_before:
|
||||
pytest.xfail("No requests to metadata while creating files!")
|
||||
@@ -304,7 +304,7 @@ def test_ioclass_metadata(filesystem):
|
||||
sync()
|
||||
|
||||
TestRun.LOGGER.info("Checking requests to metadata")
|
||||
requests_to_metadata_after = cache.get_cache_statistics(
|
||||
requests_to_metadata_after = cache.get_statistics_deprecated(
|
||||
io_class_id=ioclass_id)["write total"]
|
||||
if requests_to_metadata_after == requests_to_metadata_before:
|
||||
pytest.xfail("No requests to metadata while renaming files!")
|
||||
@@ -320,7 +320,7 @@ def test_ioclass_metadata(filesystem):
|
||||
sync()
|
||||
|
||||
TestRun.LOGGER.info("Checking requests to metadata")
|
||||
requests_to_metadata_after = cache.get_cache_statistics(
|
||||
requests_to_metadata_after = cache.get_statistics_deprecated(
|
||||
io_class_id=ioclass_id)["write total"]
|
||||
if requests_to_metadata_after == requests_to_metadata_before:
|
||||
pytest.xfail("No requests to metadata while moving files!")
|
||||
@@ -329,7 +329,7 @@ def test_ioclass_metadata(filesystem):
|
||||
fs_utils.remove(path=test_dir_path, force=True, recursive=True)
|
||||
|
||||
TestRun.LOGGER.info("Checking requests to metadata")
|
||||
requests_to_metadata_after = cache.get_cache_statistics(
|
||||
requests_to_metadata_after = cache.get_statistics_deprecated(
|
||||
io_class_id=ioclass_id)["write total"]
|
||||
if requests_to_metadata_after == requests_to_metadata_before:
|
||||
pytest.xfail("No requests to metadata while deleting directory with files!")
|
||||
@@ -409,7 +409,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
|
||||
# IO fulfilling IO class 1 condition (and not IO class 2)
|
||||
# Should be classified as IO class 4
|
||||
base_occupancy = cache.get_cache_statistics(io_class_id=4)["occupancy"]
|
||||
base_occupancy = cache.get_statistics_deprecated(io_class_id=4)["occupancy"]
|
||||
non_ioclass_file_size = Size(random.randrange(1, 25), Unit.MebiByte)
|
||||
(Fio().create_command()
|
||||
.io_engine(IoEngine.libaio)
|
||||
@@ -418,7 +418,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
.target(f"{base_dir_path}/test_file_1")
|
||||
.run())
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=4)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=4)["occupancy"]
|
||||
|
||||
assert new_occupancy == base_occupancy + non_ioclass_file_size, \
|
||||
"Writes were not properly cached!\n" \
|
||||
@@ -426,7 +426,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
|
||||
# IO fulfilling IO class 2 condition (and not IO class 1)
|
||||
# Should be classified as IO class 5
|
||||
base_occupancy = cache.get_cache_statistics(io_class_id=5)["occupancy"]
|
||||
base_occupancy = cache.get_statistics_deprecated(io_class_id=5)["occupancy"]
|
||||
(Fio().create_command()
|
||||
.io_engine(IoEngine.libaio)
|
||||
.size(ioclass_file_size)
|
||||
@@ -434,7 +434,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
.target(f"{mountpoint}/test_file_2")
|
||||
.run())
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=5)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=5)["occupancy"]
|
||||
|
||||
assert new_occupancy == base_occupancy + ioclass_file_size, \
|
||||
"Writes were not properly cached!\n" \
|
||||
@@ -450,7 +450,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
.target(f"{base_dir_path}/test_file_3")
|
||||
.run())
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=5)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=5)["occupancy"]
|
||||
|
||||
assert new_occupancy == base_occupancy + ioclass_file_size, \
|
||||
"Writes were not properly cached!\n" \
|
||||
@@ -458,7 +458,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
|
||||
# Same IO but direct
|
||||
# Should be classified as IO class 6
|
||||
base_occupancy = cache.get_cache_statistics(io_class_id=6)["occupancy"]
|
||||
base_occupancy = cache.get_statistics_deprecated(io_class_id=6)["occupancy"]
|
||||
(Fio().create_command()
|
||||
.io_engine(IoEngine.libaio)
|
||||
.size(ioclass_file_size)
|
||||
@@ -467,7 +467,7 @@ def test_ioclass_id_as_condition(filesystem):
|
||||
.direct()
|
||||
.run())
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=6)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=6)["occupancy"]
|
||||
|
||||
assert new_occupancy == base_occupancy + ioclass_file_size, \
|
||||
"Writes were not properly cached!\n" \
|
||||
@@ -507,7 +507,7 @@ def test_ioclass_conditions_or(filesystem):
|
||||
# Perform IO fulfilling each condition and check if occupancy raises
|
||||
for i in range(1, 6):
|
||||
file_size = Size(random.randint(25, 50), Unit.MebiByte)
|
||||
base_occupancy = cache.get_cache_statistics(io_class_id=1)["occupancy"]
|
||||
base_occupancy = cache.get_statistics_deprecated(io_class_id=1)["occupancy"]
|
||||
(Fio().create_command()
|
||||
.io_engine(IoEngine.libaio)
|
||||
.size(file_size)
|
||||
@@ -515,7 +515,7 @@ def test_ioclass_conditions_or(filesystem):
|
||||
.target(f"{mountpoint}/dir{i}/test_file")
|
||||
.run())
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=1)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=1)["occupancy"]
|
||||
|
||||
assert new_occupancy == base_occupancy + file_size, \
|
||||
"Occupancy has not increased correctly!\n" \
|
||||
@@ -554,7 +554,7 @@ def test_ioclass_conditions_and(filesystem):
|
||||
core.mount(mountpoint)
|
||||
sync()
|
||||
|
||||
base_occupancy = cache.get_cache_statistics(io_class_id=1)["occupancy"]
|
||||
base_occupancy = cache.get_statistics_deprecated(io_class_id=1)["occupancy"]
|
||||
# Perform IO
|
||||
for size in [file_size, file_size + Size(1, Unit.MebiByte), file_size - Size(1, Unit.MebiByte)]:
|
||||
(Fio().create_command()
|
||||
@@ -564,7 +564,7 @@ def test_ioclass_conditions_and(filesystem):
|
||||
.target(f"{mountpoint}/test_file")
|
||||
.run())
|
||||
sync()
|
||||
new_occupancy = cache.get_cache_statistics(io_class_id=1)["occupancy"]
|
||||
new_occupancy = cache.get_statistics_deprecated(io_class_id=1)["occupancy"]
|
||||
|
||||
assert new_occupancy == base_occupancy, \
|
||||
"Unexpected occupancy increase!\n" \
|
||||
|
||||
Reference in New Issue
Block a user