commit
c5af20daee
@ -3,16 +3,18 @@
|
|||||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||||
#
|
#
|
||||||
|
|
||||||
from .cli import *
|
|
||||||
from .casctl import stop as casctl_stop
|
|
||||||
from core.test_run import TestRun
|
|
||||||
from .casadm_params import *
|
|
||||||
from api.cas.cache_config import CacheLineSize, CacheMode, SeqCutOffPolicy, CleaningPolicy
|
|
||||||
from test_utils.size import Size, Unit
|
|
||||||
from typing import List
|
from typing import List
|
||||||
from storage_devices.device import Device
|
|
||||||
from api.cas.core import Core
|
|
||||||
from api.cas.cache import Cache
|
from api.cas.cache import Cache
|
||||||
|
from api.cas.cache_config import CacheLineSize, CacheMode, SeqCutOffPolicy, CleaningPolicy
|
||||||
|
from api.cas.core import Core
|
||||||
|
from core.test_run import TestRun
|
||||||
|
from storage_devices.device import Device
|
||||||
|
from test_utils.output import CmdException
|
||||||
|
from test_utils.size import Size, Unit
|
||||||
|
from .casadm_params import *
|
||||||
|
from .casctl import stop as casctl_stop
|
||||||
|
from .cli import *
|
||||||
|
|
||||||
|
|
||||||
def help(shortcut: bool = False):
|
def help(shortcut: bool = False):
|
||||||
@ -30,8 +32,7 @@ def start_cache(cache_dev: Device, cache_mode: CacheMode = None,
|
|||||||
cache_dev=cache_dev.system_path, cache_mode=_cache_mode, cache_line_size=_cache_line_size,
|
cache_dev=cache_dev.system_path, cache_mode=_cache_mode, cache_line_size=_cache_line_size,
|
||||||
cache_id=_cache_id, force=force, load=load, shortcut=shortcut))
|
cache_id=_cache_id, force=force, load=load, shortcut=shortcut))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Failed to start cache.", output)
|
||||||
f"Failed to start cache. stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return Cache(cache_dev.system_path)
|
return Cache(cache_dev.system_path)
|
||||||
|
|
||||||
|
|
||||||
@ -39,8 +40,7 @@ def stop_cache(cache_id: int, no_data_flush: bool = False, shortcut: bool = Fals
|
|||||||
output = TestRun.executor.run(
|
output = TestRun.executor.run(
|
||||||
stop_cmd(cache_id=str(cache_id), no_data_flush=no_data_flush, shortcut=shortcut))
|
stop_cmd(cache_id=str(cache_id), no_data_flush=no_data_flush, shortcut=shortcut))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Failed to stop cache.", output)
|
||||||
f"Failed to stop cache. stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@ -50,8 +50,7 @@ def add_core(cache: Cache, core_dev: Device, core_id: int = None, shortcut: bool
|
|||||||
add_core_cmd(cache_id=str(cache.cache_id), core_dev=core_dev.system_path,
|
add_core_cmd(cache_id=str(cache.cache_id), core_dev=core_dev.system_path,
|
||||||
core_id=_core_id, shortcut=shortcut))
|
core_id=_core_id, shortcut=shortcut))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Failed to add core.", output)
|
||||||
f"Failed to add core. stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return Core(core_dev.system_path, cache.cache_id)
|
return Core(core_dev.system_path, cache.cache_id)
|
||||||
|
|
||||||
|
|
||||||
@ -60,16 +59,14 @@ def remove_core(cache_id: int, core_id: int, force: bool = False, shortcut: bool
|
|||||||
remove_core_cmd(cache_id=str(cache_id), core_id=str(core_id),
|
remove_core_cmd(cache_id=str(cache_id), core_id=str(core_id),
|
||||||
force=force, shortcut=shortcut))
|
force=force, shortcut=shortcut))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Failed to remove core.", output)
|
||||||
f"Failed to remove core. stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
|
|
||||||
|
|
||||||
def remove_detached(core_device: Device, shortcut: bool = False):
|
def remove_detached(core_device: Device, shortcut: bool = False):
|
||||||
output = TestRun.executor.run(
|
output = TestRun.executor.run(
|
||||||
remove_detached_cmd(core_device=core_device.system_path, shortcut=shortcut))
|
remove_detached_cmd(core_device=core_device.system_path, shortcut=shortcut))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Failed to remove detached core.", output)
|
||||||
f"Failed to remove detached core. stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@ -78,8 +75,7 @@ def reset_counters(cache_id: int, core_id: int = None, shortcut: bool = False):
|
|||||||
output = TestRun.executor.run(
|
output = TestRun.executor.run(
|
||||||
reset_counters_cmd(cache_id=str(cache_id), core_id=_core_id, shortcut=shortcut))
|
reset_counters_cmd(cache_id=str(cache_id), core_id=_core_id, shortcut=shortcut))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Failed to reset counters.", output)
|
||||||
f"Failed to reset counters. stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@ -90,8 +86,7 @@ def flush(cache_id: int, core_id: int = None, shortcut: bool = False):
|
|||||||
command = flush_core_cmd(cache_id=str(cache_id), core_id=str(core_id), shortcut=shortcut)
|
command = flush_core_cmd(cache_id=str(cache_id), core_id=str(core_id), shortcut=shortcut)
|
||||||
output = TestRun.executor.run(command)
|
output = TestRun.executor.run(command)
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Flushing failed.", output)
|
||||||
f"Flushing failed. stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@ -99,8 +94,7 @@ def load_cache(device: Device, shortcut: bool = False):
|
|||||||
output = TestRun.executor.run(
|
output = TestRun.executor.run(
|
||||||
load_cmd(cache_dev=device.system_path, shortcut=shortcut))
|
load_cmd(cache_dev=device.system_path, shortcut=shortcut))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Failed to load cache.", output)
|
||||||
f"Failed to load cache. stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return Cache(device.system_path)
|
return Cache(device.system_path)
|
||||||
|
|
||||||
|
|
||||||
@ -109,8 +103,7 @@ def list_caches(output_format: OutputFormat = None, shortcut: bool = False):
|
|||||||
output = TestRun.executor.run(
|
output = TestRun.executor.run(
|
||||||
list_cmd(output_format=_output_format, shortcut=shortcut))
|
list_cmd(output_format=_output_format, shortcut=shortcut))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Failed to list caches.", output)
|
||||||
f"Failed to list caches. stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@ -119,8 +112,7 @@ def print_version(output_format: OutputFormat = None, shortcut: bool = False):
|
|||||||
output = TestRun.executor.run(
|
output = TestRun.executor.run(
|
||||||
version_cmd(output_format=_output_format, shortcut=shortcut))
|
version_cmd(output_format=_output_format, shortcut=shortcut))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Failed to print version.", output)
|
||||||
f"Failed to print version. stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@ -128,8 +120,7 @@ def format_nvme(cache_dev: Device, force: bool = False, shortcut: bool = False):
|
|||||||
output = TestRun.executor.run(
|
output = TestRun.executor.run(
|
||||||
format_cmd(cache_dev=cache_dev.system_path, force=force, shortcut=shortcut))
|
format_cmd(cache_dev=cache_dev.system_path, force=force, shortcut=shortcut))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Format command failed.", output)
|
||||||
f"Format command failed. stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@ -140,8 +131,7 @@ def stop_all_caches():
|
|||||||
casctl_stop()
|
casctl_stop()
|
||||||
output = list_caches()
|
output = list_caches()
|
||||||
if "No caches running" not in output.stdout:
|
if "No caches running" not in output.stdout:
|
||||||
raise Exception(
|
raise CmdException("Error while stopping caches.", output)
|
||||||
f"Error while stopping caches. stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
|
|
||||||
|
|
||||||
def print_statistics(cache_id: int, core_id: int = None, per_io_class: bool = False,
|
def print_statistics(cache_id: int, core_id: int = None, per_io_class: bool = False,
|
||||||
@ -161,8 +151,7 @@ def print_statistics(cache_id: int, core_id: int = None, per_io_class: bool = Fa
|
|||||||
per_io_class=per_io_class, io_class_id=_io_class_id,
|
per_io_class=per_io_class, io_class_id=_io_class_id,
|
||||||
filter=_filter, output_format=_output_format, shortcut=shortcut))
|
filter=_filter, output_format=_output_format, shortcut=shortcut))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Printing statistics failed.", output)
|
||||||
f"Printing statistics failed. stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@ -178,8 +167,7 @@ def set_cache_mode(cache_mode: CacheMode, cache_id: int,
|
|||||||
set_cache_mode_cmd(cache_mode=cache_mode.name.lower(), cache_id=str(cache_id),
|
set_cache_mode_cmd(cache_mode=cache_mode.name.lower(), cache_id=str(cache_id),
|
||||||
flush_cache=flush_cache, shortcut=shortcut))
|
flush_cache=flush_cache, shortcut=shortcut))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Set cache mode command failed.", output)
|
||||||
f"Set cache mode command failed. stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@ -187,8 +175,7 @@ def load_io_classes(cache_id: int, file: str, shortcut: bool = False):
|
|||||||
output = TestRun.executor.run(
|
output = TestRun.executor.run(
|
||||||
load_io_classes_cmd(cache_id=str(cache_id), file=file, shortcut=shortcut))
|
load_io_classes_cmd(cache_id=str(cache_id), file=file, shortcut=shortcut))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Load IO class command failed.", output)
|
||||||
f"Load IO class command failed. stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@ -198,8 +185,7 @@ def list_io_classes(cache_id: int, output_format: OutputFormat, shortcut: bool =
|
|||||||
list_io_classes_cmd(cache_id=str(cache_id),
|
list_io_classes_cmd(cache_id=str(cache_id),
|
||||||
output_format=_output_format, shortcut=shortcut))
|
output_format=_output_format, shortcut=shortcut))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("List IO class command failed.", output)
|
||||||
f"List IO class command failed. stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@ -210,9 +196,7 @@ def get_param_cutoff(cache_id: int, core_id: int,
|
|||||||
get_param_cutoff_cmd(cache_id=str(cache_id), core_id=str(core_id),
|
get_param_cutoff_cmd(cache_id=str(cache_id), core_id=str(core_id),
|
||||||
output_format=_output_format, shortcut=shortcut))
|
output_format=_output_format, shortcut=shortcut))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Getting sequential cutoff params failed.", output)
|
||||||
f"Getting sequential cutoff params failed."
|
|
||||||
f" stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@ -222,9 +206,7 @@ def get_param_cleaning(cache_id: int, output_format: OutputFormat = None, shortc
|
|||||||
get_param_cleaning_cmd(cache_id=str(cache_id), output_format=_output_format,
|
get_param_cleaning_cmd(cache_id=str(cache_id), output_format=_output_format,
|
||||||
shortcut=shortcut))
|
shortcut=shortcut))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Getting cleaning policy params failed.", output)
|
||||||
f"Getting cleaning policy params failed."
|
|
||||||
f" stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@ -235,9 +217,7 @@ def get_param_cleaning_alru(cache_id: int, output_format: OutputFormat = None,
|
|||||||
get_param_cleaning_alru_cmd(cache_id=str(cache_id), output_format=_output_format,
|
get_param_cleaning_alru_cmd(cache_id=str(cache_id), output_format=_output_format,
|
||||||
shortcut=shortcut))
|
shortcut=shortcut))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Getting alru cleaning policy params failed.", output)
|
||||||
f"Getting alru cleaning policy params failed."
|
|
||||||
f" stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@ -248,9 +228,7 @@ def get_param_cleaning_acp(cache_id: int, output_format: OutputFormat = None,
|
|||||||
get_param_cleaning_acp_cmd(cache_id=str(cache_id), output_format=_output_format,
|
get_param_cleaning_acp_cmd(cache_id=str(cache_id), output_format=_output_format,
|
||||||
shortcut=shortcut))
|
shortcut=shortcut))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Getting acp cleaning policy params failed.", output)
|
||||||
f"Getting acp cleaning policy params failed."
|
|
||||||
f" stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@ -262,9 +240,7 @@ def set_param_cutoff(cache_id: int, core_id: int = None, threshold: Size = None,
|
|||||||
threshold=_threshold, policy=policy)
|
threshold=_threshold, policy=policy)
|
||||||
output = TestRun.executor.run(command)
|
output = TestRun.executor.run(command)
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Error while setting sequential cut-off params.", output)
|
||||||
f"Error while setting sequential cut-off params."
|
|
||||||
f" stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@ -272,9 +248,7 @@ def set_param_cleaning(cache_id: int, policy: CleaningPolicy):
|
|||||||
output = TestRun.executor.run(
|
output = TestRun.executor.run(
|
||||||
set_param_cleaning_cmd(cache_id=str(cache_id), policy=policy.name))
|
set_param_cleaning_cmd(cache_id=str(cache_id), policy=policy.name))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Error while setting cleaning policy.", output)
|
||||||
f"Error while setting cleaning policy."
|
|
||||||
f" stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@ -285,9 +259,7 @@ def set_param_cleaning_alru(cache_id: int, wake_up: int = None, staleness_time:
|
|||||||
cache_id=str(cache_id), wake_up=str(wake_up), staleness_time=str(staleness_time),
|
cache_id=str(cache_id), wake_up=str(wake_up), staleness_time=str(staleness_time),
|
||||||
flush_max_buffers=str(flush_max_buffers), activity_threshold=str(activity_threshold)))
|
flush_max_buffers=str(flush_max_buffers), activity_threshold=str(activity_threshold)))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Error while setting alru cleaning policy parameters.", output)
|
||||||
f"Error while setting alru cleaning policy parameters."
|
|
||||||
f" stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
@ -296,7 +268,5 @@ def set_param_cleaning_acp(cache_id: int, wake_up: int = None, flush_max_buffers
|
|||||||
set_param_cleaning_acp_cmd(cache_id=str(cache_id), wake_up=str(wake_up),
|
set_param_cleaning_acp_cmd(cache_id=str(cache_id), wake_up=str(wake_up),
|
||||||
flush_max_buffers=str(flush_max_buffers)))
|
flush_max_buffers=str(flush_max_buffers)))
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
raise Exception(
|
raise CmdException("Error while setting acp cleaning policy parameters.", output)
|
||||||
f"Error while setting acp cleaning policy parameters."
|
|
||||||
f" stdout: {output.stdout} \n stderr :{output.stderr}")
|
|
||||||
return output
|
return output
|
||||||
|
@ -3,14 +3,22 @@
|
|||||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||||
#
|
#
|
||||||
|
|
||||||
from api.cas import casadm
|
import json
|
||||||
from test_utils.size import parse_unit
|
import re
|
||||||
from api.cas.cache_config import *
|
|
||||||
from api.cas.casadm_params import *
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from packaging import version
|
from packaging import version
|
||||||
import re
|
|
||||||
|
from api.cas import casadm
|
||||||
|
from api.cas.cache_config import *
|
||||||
|
from api.cas.casadm_params import *
|
||||||
|
from test_utils.size import parse_unit
|
||||||
|
|
||||||
|
|
||||||
|
class Stats(dict):
|
||||||
|
def __str__(self):
|
||||||
|
return json.dumps(self, default=lambda o: str(o), indent=2)
|
||||||
|
|
||||||
|
|
||||||
def parse_stats_unit(unit: str):
|
def parse_stats_unit(unit: str):
|
||||||
@ -50,7 +58,7 @@ def get_statistics(
|
|||||||
filter: List[casadm.StatsFilter] = None,
|
filter: List[casadm.StatsFilter] = None,
|
||||||
percentage_val: bool = False,
|
percentage_val: bool = False,
|
||||||
):
|
):
|
||||||
stats = {}
|
stats = Stats()
|
||||||
|
|
||||||
_filter = get_filter(filter)
|
_filter = get_filter(filter)
|
||||||
|
|
||||||
|
@ -5,9 +5,10 @@
|
|||||||
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from api.cas import casadm, casadm_parser
|
from api.cas import casadm, casadm_parser
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_utils.size import Unit, Size
|
from test_utils.size import Unit, Size
|
||||||
|
|
||||||
|
|
||||||
@ -45,6 +46,7 @@ def test_cli_start_stop_default_value(shortcut):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.nand, DiskType.optane]))
|
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.nand, DiskType.optane]))
|
||||||
|
@pytest.mark.require_disk("core", DiskTypeLowerThan("cache"))
|
||||||
@pytest.mark.parametrize("shortcut", [True, False])
|
@pytest.mark.parametrize("shortcut", [True, False])
|
||||||
def test_cli_add_remove_default_value(shortcut):
|
def test_cli_add_remove_default_value(shortcut):
|
||||||
cache_device = TestRun.disks['cache']
|
cache_device = TestRun.disks['cache']
|
||||||
@ -52,8 +54,7 @@ def test_cli_add_remove_default_value(shortcut):
|
|||||||
cache_device = cache_device.partitions[0]
|
cache_device = cache_device.partitions[0]
|
||||||
cache = casadm.start_cache(cache_device, shortcut=shortcut, force=True)
|
cache = casadm.start_cache(cache_device, shortcut=shortcut, force=True)
|
||||||
|
|
||||||
core_device = next(
|
core_device = TestRun.disks['core']
|
||||||
disk for disk in TestRun.dut.disks if disk.disk_type != DiskType.optane)
|
|
||||||
casadm.add_core(cache, core_device, shortcut=shortcut)
|
casadm.add_core(cache, core_device, shortcut=shortcut)
|
||||||
|
|
||||||
caches = casadm_parser.get_caches()
|
caches = casadm_parser.get_caches()
|
||||||
|
@ -5,12 +5,13 @@
|
|||||||
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from api.cas import casadm
|
||||||
|
from api.cas.cache_config import CacheMode
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_utils.size import Size, Unit
|
|
||||||
from api.cas.cache_config import CacheMode
|
|
||||||
from api.cas import casadm
|
|
||||||
from test_tools.dd import Dd
|
from test_tools.dd import Dd
|
||||||
|
from test_utils.size import Size, Unit
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||||
@ -63,7 +64,6 @@ def test_core_inactive_stats():
|
|||||||
|
|
||||||
cache_device = cache.cache_device
|
cache_device = cache.cache_device
|
||||||
|
|
||||||
TestRun.LOGGER.info(cache_device)
|
|
||||||
TestRun.LOGGER.info("Switching cache mode to WB")
|
TestRun.LOGGER.info("Switching cache mode to WB")
|
||||||
cache.set_cache_mode(cache_mode=CacheMode.WB)
|
cache.set_cache_mode(cache_mode=CacheMode.WB)
|
||||||
cores = cache.get_core_devices()
|
cores = cache.get_core_devices()
|
||||||
@ -125,7 +125,7 @@ def test_core_inactive_stats():
|
|||||||
inactive_clean_perc = round(100 * inactive_clean_perc, 1)
|
inactive_clean_perc = round(100 * inactive_clean_perc, 1)
|
||||||
inactive_dirty_perc = round(100 * inactive_dirty_perc, 1)
|
inactive_dirty_perc = round(100 * inactive_dirty_perc, 1)
|
||||||
|
|
||||||
TestRun.LOGGER.info(cache_stats_percentage)
|
TestRun.LOGGER.info(str(cache_stats_percentage))
|
||||||
assert inactive_occupancy_perc == cache_stats_percentage["inactive occupancy"]
|
assert inactive_occupancy_perc == cache_stats_percentage["inactive occupancy"]
|
||||||
assert inactive_clean_perc == cache_stats_percentage["inactive clean"]
|
assert inactive_clean_perc == cache_stats_percentage["inactive clean"]
|
||||||
assert inactive_dirty_perc == cache_stats_percentage["inactive dirty"]
|
assert inactive_dirty_perc == cache_stats_percentage["inactive dirty"]
|
||||||
|
Loading…
Reference in New Issue
Block a user