Merge pull request #1529 from Kamoppl/kamilg/fix_scope_bugs
Kamilg/Fix tests and update test API functionality
This commit is contained in:
commit
388e1ac3c7
@ -235,10 +235,10 @@ def get_param_cleaning_acp(
|
|||||||
|
|
||||||
|
|
||||||
def set_cache_mode(
|
def set_cache_mode(
|
||||||
cache_mode: CacheMode, cache_id: int, flush=None, shortcut: bool = False
|
cache_mode: CacheMode, cache_id: int, flush: bool = None, shortcut: bool = False
|
||||||
) -> Output:
|
) -> Output:
|
||||||
flush_cache = None
|
flush_cache = None
|
||||||
if flush:
|
if flush is not None:
|
||||||
flush_cache = "yes" if flush else "no"
|
flush_cache = "yes" if flush else "no"
|
||||||
output = TestRun.executor.run(
|
output = TestRun.executor.run(
|
||||||
set_cache_mode_cmd(
|
set_cache_mode_cmd(
|
||||||
|
@ -6,16 +6,16 @@
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from api.cas import casadm
|
||||||
from api.cas.cache_config import CacheMode, CacheLineSize
|
from api.cas.cache_config import CacheMode, CacheLineSize
|
||||||
from api.cas.casadm_params import OutputFormat
|
from api.cas.casadm_params import OutputFormat
|
||||||
from api.cas.cli import start_cmd
|
from api.cas.cli import start_cmd
|
||||||
from core.test_run import TestRun
|
|
||||||
from api.cas import casadm
|
|
||||||
from api.cas.cli_messages import (
|
from api.cas.cli_messages import (
|
||||||
check_stderr_msg,
|
check_stderr_msg,
|
||||||
start_cache_on_already_used_dev,
|
start_cache_on_already_used_dev,
|
||||||
start_cache_with_existing_id,
|
start_cache_with_existing_id,
|
||||||
)
|
)
|
||||||
|
from core.test_run import TestRun
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_tools import fs_utils
|
from test_tools import fs_utils
|
||||||
from test_tools.dd import Dd
|
from test_tools.dd import Dd
|
||||||
@ -81,31 +81,31 @@ def test_negative_start_cache():
|
|||||||
|
|
||||||
with TestRun.step("Start cache on the same device but with another ID"):
|
with TestRun.step("Start cache on the same device but with another ID"):
|
||||||
try:
|
try:
|
||||||
output = TestRun.executor.run(
|
output = TestRun.executor.run_expect_fail(
|
||||||
start_cmd(
|
start_cmd(
|
||||||
cache_dev=cache_dev_1.path,
|
cache_dev=cache_dev_1.path,
|
||||||
cache_id="2",
|
cache_id="2",
|
||||||
force=True,
|
force=True,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
TestRun.fail("Two caches started on same device")
|
|
||||||
except CmdException:
|
|
||||||
if not check_stderr_msg(output, start_cache_on_already_used_dev):
|
if not check_stderr_msg(output, start_cache_on_already_used_dev):
|
||||||
TestRun.fail(f"Received unexpected error message: {output.stderr}")
|
TestRun.fail(f"Received unexpected error message: {output.stderr}")
|
||||||
|
except CmdException:
|
||||||
|
TestRun.fail("Two caches started on same device")
|
||||||
|
|
||||||
with TestRun.step("Start cache with the same ID on another cache device"):
|
with TestRun.step("Start cache with the same ID on another cache device"):
|
||||||
try:
|
try:
|
||||||
output = TestRun.executor.run(
|
output = TestRun.executor.run_expect_fail(
|
||||||
start_cmd(
|
start_cmd(
|
||||||
cache_dev=cache_dev_2.path,
|
cache_dev=cache_dev_2.path,
|
||||||
cache_id="1",
|
cache_id="1",
|
||||||
force=True,
|
force=True,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
TestRun.fail("Two caches started with same ID")
|
|
||||||
except CmdException:
|
|
||||||
if not check_stderr_msg(output, start_cache_with_existing_id):
|
if not check_stderr_msg(output, start_cache_with_existing_id):
|
||||||
TestRun.fail(f"Received unexpected error message: {output.stderr}")
|
TestRun.fail(f"Received unexpected error message: {output.stderr}")
|
||||||
|
except CmdException:
|
||||||
|
TestRun.fail("Two caches started with same ID")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.CI
|
@pytest.mark.CI
|
||||||
|
@ -130,6 +130,7 @@ def test_cleaning_policies_in_write_through(cleaning_policy):
|
|||||||
|
|
||||||
with TestRun.step(f"Start cache in Write-Through mode with {cleaning_policy} cleaning policy"):
|
with TestRun.step(f"Start cache in Write-Through mode with {cleaning_policy} cleaning policy"):
|
||||||
cache = casadm.start_cache(cache_dev.partitions[0], CacheMode.WT, force=True)
|
cache = casadm.start_cache(cache_dev.partitions[0], CacheMode.WT, force=True)
|
||||||
|
cache.set_cleaning_policy(cleaning_policy=cleaning_policy)
|
||||||
set_cleaning_policy_params(cache, cleaning_policy)
|
set_cleaning_policy_params(cache, cleaning_policy)
|
||||||
|
|
||||||
with TestRun.step("Check for running CAS cleaner"):
|
with TestRun.step("Check for running CAS cleaner"):
|
||||||
@ -256,7 +257,7 @@ def check_cleaning_policy_operation(
|
|||||||
case CleaningPolicy.nop:
|
case CleaningPolicy.nop:
|
||||||
if (
|
if (
|
||||||
core_writes_after_wait_for_cleaning != Size.zero()
|
core_writes_after_wait_for_cleaning != Size.zero()
|
||||||
or core_writes_before_wait_for_cleaning.value != Size.zero()
|
or core_writes_before_wait_for_cleaning != Size.zero()
|
||||||
):
|
):
|
||||||
TestRun.LOGGER.error(
|
TestRun.LOGGER.error(
|
||||||
"NOP cleaning policy is not working properly! "
|
"NOP cleaning policy is not working properly! "
|
||||||
|
Loading…
Reference in New Issue
Block a user