Merge pull request #1197 from katlapinka/ioclass-neg-config
Add IO class test for loading wrong IO class configuration
This commit is contained in:
@@ -169,6 +169,68 @@ cache_line_size_mismatch = [
|
||||
r"Cache line size mismatch"
|
||||
]
|
||||
|
||||
headerless_io_class_config = [
|
||||
r'Cannot parse configuration file - unknown column "1"\.\n'
|
||||
r'Failed to parse I/O classes configuration file header\. It is either malformed or missing\.\n'
|
||||
r'Please consult Admin Guide to check how columns in configuration file should be named\.'
|
||||
]
|
||||
|
||||
illegal_io_class_config_L2C1 = [
|
||||
r"Cannot parse configuration file - error in line 2 in column 1 \(IO class id\)\."
|
||||
]
|
||||
|
||||
illegal_io_class_config_L2C2 = [
|
||||
r"Empty or too long IO class name\n"
|
||||
r"Cannot parse configuration file - error in line 2 in column 2 \(IO class name\)\."
|
||||
]
|
||||
|
||||
illegal_io_class_config_L2C4 = [
|
||||
r"Cannot parse configuration file - error in line 2 in column 4 \(Allocation\)\."
|
||||
]
|
||||
|
||||
illegal_io_class_config_L2 = [
|
||||
r"Cannot parse configuration file - error in line 2\."
|
||||
]
|
||||
|
||||
double_io_class_config = [
|
||||
r"Double configuration for IO class id \d+\n"
|
||||
r"Cannot parse configuration file - error in line \d+ in column \d+ \(IO class id\)\."
|
||||
]
|
||||
|
||||
illegal_io_class_invalid_id = [
|
||||
r"Invalid id, must be a correct unsigned decimal integer\.\n"
|
||||
r"Cannot parse configuration file - error in line 2 in column 1 \(IO class id\)\."
|
||||
]
|
||||
|
||||
illegal_io_class_invalid_id_number = [
|
||||
r"Invalid id, must be in the range 0-32\.\n"
|
||||
r"Cannot parse configuration file - error in line 2 in column 1 \(IO class id\)\."
|
||||
]
|
||||
|
||||
illegal_io_class_invalid_priority = [
|
||||
r"Invalid prio, must be a correct unsigned decimal integer\.\n"
|
||||
r"Cannot parse configuration file - error in line 2 in column 3 \(Eviction priority\)"
|
||||
]
|
||||
|
||||
illegal_io_class_invalid_priority_number = [
|
||||
r"Invalid prio, must be in the range 0-255\.\n"
|
||||
r"Cannot parse configuration file - error in line 2 in column 3 \(Eviction priority\)"
|
||||
]
|
||||
|
||||
illegal_io_class_invalid_allocation = [
|
||||
r"Cannot parse configuration file - error in line 2 in column 4 \(Allocation\)\."
|
||||
]
|
||||
|
||||
illegal_io_class_invalid_allocation_number = [
|
||||
r"Cannot parse configuration file - error in line 2 in column 4 \(Allocation\)\."
|
||||
]
|
||||
|
||||
malformed_io_class_header = [
|
||||
r'Cannot parse configuration file - unknown column \"value_template\"\.\n'
|
||||
r'Failed to parse I/O classes configuration file header\. It is either malformed or missing\.\n'
|
||||
r'Please consult Admin Guide to check how columns in configuration file should be named\.'
|
||||
]
|
||||
|
||||
|
||||
def check_stderr_msg(output: Output, expected_messages):
|
||||
return __check_string_msg(output.stderr, expected_messages)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright(c) 2019-2021 Intel Corporation
|
||||
# Copyright(c) 2019-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
@@ -87,6 +87,19 @@ class IoClass:
|
||||
def default(priority=DEFAULT_IO_CLASS_PRIORITY, allocation="1.00"):
|
||||
return IoClass(DEFAULT_IO_CLASS_ID, DEFAULT_IO_CLASS_RULE, priority, allocation)
|
||||
|
||||
@staticmethod
|
||||
def default_header_dict():
|
||||
return {
|
||||
"id": "IO class id",
|
||||
"name": "IO class name",
|
||||
"eviction_prio": "Eviction priority",
|
||||
"allocation": "Allocation"
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def default_header():
|
||||
return ','.join(IoClass.default_header_dict().values())
|
||||
|
||||
@staticmethod
|
||||
def compare_ioclass_lists(list1: [], list2: []):
|
||||
return sorted(list1) == sorted(list2)
|
||||
@@ -94,10 +107,10 @@ class IoClass:
|
||||
@staticmethod
|
||||
def generate_random_ioclass_list(count: int, max_priority: int = MAX_IO_CLASS_PRIORITY):
|
||||
random_list = [IoClass.default(priority=random.randint(0, max_priority),
|
||||
allocation=f"{random.randint(0,100)/100:0.2f}")]
|
||||
allocation=f"{random.randint(0, 100) / 100:0.2f}")]
|
||||
for i in range(1, count):
|
||||
random_list.append(IoClass(i, priority=random.randint(0, max_priority),
|
||||
allocation=f"{random.randint(0,100)/100:0.2f}")
|
||||
allocation=f"{random.randint(0, 100) / 100:0.2f}")
|
||||
.set_random_rule())
|
||||
return random_list
|
||||
|
||||
|
Reference in New Issue
Block a user