Compare commits

..

1 Commits

Author SHA1 Message Date
02a209aff8 [test] Add unit tests for ACP and ALRU cleaning policy parameters
- Add tests for wake-up and flush-max-buffers parameter validation
- Test parameter boundary values and error conditions
- Cover parameter parsing from configuration strings
- Verify set_param_cleaning_policy commands construction
- Test proper handling of different cleaning policies in configure_cache

These tests ensure the proper validation and handling of cleaning policy
parameters introduced in the previous commits.
2025-04-17 14:21:47 +08:00

View File

@ -219,6 +219,9 @@ class cas_config(object):
if not stat.S_ISBLK(mode):
raise ValueError(f'{path} is not block device')
def __str__(self):
return f"cas_config(caches={[str(cache) for cache in self.caches.values()]}, cores={[str(core) for core in self.cores]}, version_tag={self.version_tag})"
class cache_config(object):
def __init__(self, cache_id, device, cache_mode, **params):
self.cache_id = int(cache_id)
@ -227,6 +230,9 @@ class cas_config(object):
self.params = params
self.cores = dict()
def __str__(self):
return f"cache_config(cache_id={self.cache_id}, device={self.device}, cache_mode={self.cache_mode}, params={self.params}, cores={self.cores})"
@classmethod
def from_line(cls, line, allow_incomplete=False):
values = line.split()
@ -387,6 +393,9 @@ class cas_config(object):
self.device = path
self.params = params
def __str__(self):
return f"core_config(cache_id={self.cache_id}, core_id={self.core_id}, device={self.device}, params={self.params})"
@classmethod
def from_line(cls, line, allow_incomplete=False):
values = line.split()
@ -646,12 +655,12 @@ def configure_cache(cache):
)
def add_core(core, attach):
def add_core(core, try_add):
casadm.add_core(
device=core.device,
cache_id=core.cache_id,
core_id=core.core_id,
try_add=attach)
try_add=try_add)
# Another helper functions