diff --git a/test/functional/api/cas/cache.py b/test/functional/api/cas/cache.py index f041b25..acb89aa 100644 --- a/test/functional/api/cas/cache.py +++ b/test/functional/api/cas/cache.py @@ -140,3 +140,10 @@ class Cache: alru_params.staleness_time.total_seconds(), alru_params.flush_max_buffers, alru_params.activity_threshold.total_milliseconds()) + + def get_cache_config(self): + return CacheConfig(self.get_cache_line_size(), + self.get_cache_mode(), + self.get_cleaning_policy(), + self.get_eviction_policy(), + self.get_metadata_mode()) diff --git a/test/functional/api/cas/cache_config.py b/test/functional/api/cas/cache_config.py index c42d20b..8d028f0 100644 --- a/test/functional/api/cas/cache_config.py +++ b/test/functional/api/cas/cache_config.py @@ -37,6 +37,7 @@ class EvictionPolicy(Enum): lru = 0 lmp = 1 nop = 2 + DEFAULT = lru class MetadataMode(Enum): @@ -110,5 +111,22 @@ class SeqCutOffParameters: # TODO: Use case for this will be to iterate over configurations (kernel params such as # TODO: io scheduler, metadata layout) and prepare env before starting cache class CacheConfig: - def __init__(self): - pass + def __init__(self, + cache_line_size=CacheLineSize.DEFAULT, + cache_mode=CacheMode.DEFAULT, + cleaning_policy=CleaningPolicy.DEFAULT, + eviction_policy=EvictionPolicy.DEFAULT, + metadata_mode=MetadataMode.normal): + self.cache_line_size = cache_line_size + self.cache_mode = cache_mode + self.cleaning_policy = cleaning_policy + self.eviction_policy = eviction_policy + self.metadata_mode = metadata_mode + + +def __eq__(self, other): + return self.cache_line_size == other.cache_line_size and \ + self.cache_mode == other.cache_mode and \ + self.cleaning_policy == other.cleaning_policy and \ + self.eviction_policy == other.eviction_policy and \ + self.metadata_mode == other.metadata_mode diff --git a/test/functional/api/cas/cas_module.py b/test/functional/api/cas/cas_module.py index 20ec94e..09faa7e 100644 --- a/test/functional/api/cas/cas_module.py +++ b/test/functional/api/cas/cas_module.py @@ -3,14 +3,13 @@ # SPDX-License-Identifier: BSD-3-Clause-Clear # from aenum import Enum -from config.configuration import cas_kernel_module, disk_kernel_module from test_utils import os_utils from test_utils.os_utils import ModuleRemoveMethod class CasModule(Enum): - cache = cas_kernel_module - disk = disk_kernel_module + cache = "cas_cache" + disk = "cas_disk" def reload_all_cas_modules(): diff --git a/test/functional/test-framework b/test/functional/test-framework index de0721e..c00e1f1 160000 --- a/test/functional/test-framework +++ b/test/functional/test-framework @@ -1 +1 @@ -Subproject commit de0721eb52fbe548a8e7810913151e2e37c66d1c +Subproject commit c00e1f19425e289c281f97b7f6cca1fb88e3f9bc diff --git a/test/functional/tests/conftest.py b/test/functional/tests/conftest.py index 9ae61f6..1b042ea 100644 --- a/test/functional/tests/conftest.py +++ b/test/functional/tests/conftest.py @@ -183,6 +183,8 @@ def base_prepare(item): elif not installer.check_if_installed(): installer.install_opencas() TestRun.plugins['opencas']['already_updated'] = True + from api.cas import init_config + init_config.create_default_init_config() TestRun.LOGGER.add_build_info(f'Commit hash:') TestRun.LOGGER.add_build_info(f"{git.get_current_commit_hash()}") TestRun.LOGGER.add_build_info(f'Commit message:')