From b6028a87879582c26e4ec243d864d914dbe5af20 Mon Sep 17 00:00:00 2001 From: Ostrokrzew Date: Thu, 12 Dec 2019 14:30:25 +0100 Subject: [PATCH] Minor fixes in CAS API Add casting to int in few cleaning policy params. Fix few typos. Add equation overload in cleaning policy params' classes. Signed-off-by: Ostrokrzew --- test/functional/api/cas/cache_config.py | 10 ++++++++++ test/functional/api/cas/casadm_parser.py | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/test/functional/api/cas/cache_config.py b/test/functional/api/cas/cache_config.py index 5aa3965..f5bc37b 100644 --- a/test/functional/api/cas/cache_config.py +++ b/test/functional/api/cas/cache_config.py @@ -95,6 +95,12 @@ class FlushParametersAlru: self.staleness_time = staleness_time self.wake_up_time = wake_up_time + def __eq__(self, other): + return self.activity_threshold == other.activity_threshold and \ + self.flush_max_buffers == other.flush_max_buffers and \ + self.staleness_time == other.staleness_time and \ + self.wake_up_time == other.wake_up_time + @staticmethod def default_alru_params(): alru_params = FlushParametersAlru() @@ -112,6 +118,10 @@ class FlushParametersAcp: self.flush_max_buffers = flush_max_buffers self.wake_up_time = wake_up_time + def __eq__(self, other): + return self.flush_max_buffers == other.flush_max_buffers and \ + self.wake_up_time == other.wake_up_time + @staticmethod def default_acp_params(): acp_params = FlushParametersAcp() diff --git a/test/functional/api/cas/casadm_parser.py b/test/functional/api/cas/casadm_parser.py index c608e95..527b3dc 100644 --- a/test/functional/api/cas/casadm_parser.py +++ b/test/functional/api/cas/casadm_parser.py @@ -214,7 +214,7 @@ def get_cas_devices_dict(): def get_flush_parameters_alru(cache_id: int): casadm_output = casadm.get_param_cleaning_alru(cache_id, - casadm.OutputFormat.csv).stdout.spltlines() + casadm.OutputFormat.csv).stdout.splitlines() flush_parameters = FlushParametersAlru() for line in casadm_output: if 'max buffers' in line: @@ -222,7 +222,7 @@ def get_flush_parameters_alru(cache_id: int): if 'Activity threshold' in line: flush_parameters.activity_threshold = Time(milliseconds=int(line.split(',')[1])) if 'Stale buffer time' in line: - flush_parameters.staneless_time = Time(seconds=int(line.split(',')[1])) + flush_parameters.staleness_time = Time(seconds=int(line.split(',')[1])) if 'Wake up time' in line: flush_parameters.wake_up_time = Time(seconds=int(line.split(',')[1])) return flush_parameters