Skip to content

Commit 237e25d

Browse files
author
Kamil Gierszewski
committed
tests: refactor io_class_pinning test
Signed-off-by: Kamil Gierszewski <[email protected]>
1 parent 2400ba8 commit 237e25d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/functional/tests/io_class/test_io_class_pinning_eviction.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#
22
# Copyright(c) 2022 Intel Corporation
3-
# Copyright(c) 2024-2025 Huawei Technologies
3+
# Copyright(c) 2024-2025 Huawei Technologies Co., Ltd.
44
# SPDX-License-Identifier: BSD-3-Clause
55
#
66

@@ -9,6 +9,7 @@
99
from collections import namedtuple
1010
from math import isclose
1111

12+
from api.cas.casadm_params import StatsFilter
1213
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
1314
from api.cas.ioclass_config import IoClass, default_config_file_path
1415
from test_tools.fs_tools import Filesystem, create_directory
@@ -142,6 +143,7 @@ def test_pinned_ioclasses_eviction():
142143
with TestRun.step("Prepare devices"):
143144
cache, core = prepare(core_size=core_size, cache_size=cache_size)
144145
cache_line_count = cache.get_statistics().config_stats.cache_size
146+
cache_free_block = cache.get_statistics(stat_filter=[StatsFilter.usage]).usage_stats.free
145147

146148
with TestRun.step("Mount filesystem"):
147149
core.create_filesystem(Filesystem.xfs)
@@ -190,7 +192,7 @@ def test_pinned_ioclasses_eviction():
190192
with TestRun.step(f"Trigger IO to first pinned class directory"):
191193
run_io_dir(
192194
f"{io_classes[0].dir_path}/tmp_file",
193-
int((io_classes[0].max_occupancy * cache_size) / Unit.Blocks4096),
195+
int(io_classes[0].max_occupancy * cache_free_block.get_value(Unit.Blocks4096)),
194196
)
195197
first_io_pinned_occupancy = get_io_class_occupancy(cache, io_classes[0].id)
196198

0 commit comments

Comments
 (0)