[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.
This commit is contained in:
@@ -278,9 +278,9 @@ class cas_config(object):
|
||||
self.check_lazy_startup_valid(param_value)
|
||||
elif param_name == "target_failover_state":
|
||||
self.check_failover_state_valid(param_value)
|
||||
elif param_name == "wake-up":
|
||||
elif param_name == "wake_up":
|
||||
self.check_wake_up_valid(param_value)
|
||||
elif param_name == "flush-max-buffers":
|
||||
elif param_name == "flush_max_buffers":
|
||||
self.check_flush_max_buffers_valid(param_value)
|
||||
else:
|
||||
raise ValueError(f'{param_name} is invalid parameter name')
|
||||
@@ -332,24 +332,24 @@ class cas_config(object):
|
||||
if self.params.get("cleaning_policy") == "acp":
|
||||
if not wake_up.isdigit():
|
||||
raise ValueError(f"{wake_up} is invalid wake-up value for acp cleaning policy")
|
||||
if int(wake_up) not in range(0, 10000):
|
||||
if int(wake_up) not in range(0, 10001):
|
||||
raise ValueError(f"{wake_up} is invalid wake-up value for acp cleaning policy")
|
||||
elif self.params.get("cleaning_policy") == "alru":
|
||||
if not wake_up.isdigit():
|
||||
raise ValueError(f"{wake_up} is invalid wake-up value for alru cleaning policy")
|
||||
if int(wake_up) not in range(0, 3600):
|
||||
if int(wake_up) not in range(0, 3601):
|
||||
raise ValueError(f"{wake_up} is invalid wake-up value for alru cleaning policy")
|
||||
|
||||
def check_flush_max_buffers_valid(self, flush_max_buffers):
|
||||
if self.params.get("cleaning_policy") == "acp":
|
||||
if not flush_max_buffers.isdigit():
|
||||
raise ValueError(f"{flush_max_buffers} is invalid flush-max-buffers value for acp cleaning policy")
|
||||
if int(flush_max_buffers) not in range(1, 10000):
|
||||
if int(flush_max_buffers) not in range(1, 10001):
|
||||
raise ValueError(f"{flush_max_buffers} is invalid flush-max-buffers value for acp cleaning policy")
|
||||
elif self.params.get("cleaning_policy") == "alru":
|
||||
if not flush_max_buffers.isdigit():
|
||||
raise ValueError(f"{flush_max_buffers} is invalid flush-max-buffers value for alru cleaning policy")
|
||||
if int(flush_max_buffers) not in range(1, 10000):
|
||||
if int(flush_max_buffers) not in range(1, 10001):
|
||||
raise ValueError(f"{flush_max_buffers} is invalid flush-max-buffers value for alru cleaning policy")
|
||||
def check_recursive(self):
|
||||
if not self.device.startswith('/dev/cas'):
|
||||
|
Reference in New Issue
Block a user