Merge pull request #1529 from Kamoppl/kamilg/fix_scope_bugs

Kamilg/Fix tests and update test API functionality
This commit is contained in:
Robert Baldyga 2024-09-23 13:39:37 +02:00 committed by GitHub
commit 388e1ac3c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 11 deletions

View File

@ -235,10 +235,10 @@ def get_param_cleaning_acp(
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:
flush_cache = None
if flush:
if flush is not None:
flush_cache = "yes" if flush else "no"
output = TestRun.executor.run(
set_cache_mode_cmd(

View File

@ -6,16 +6,16 @@
import pytest
from api.cas import casadm
from api.cas.cache_config import CacheMode, CacheLineSize
from api.cas.casadm_params import OutputFormat
from api.cas.cli import start_cmd
from core.test_run import TestRun
from api.cas import casadm
from api.cas.cli_messages import (
check_stderr_msg,
start_cache_on_already_used_dev,
start_cache_with_existing_id,
)
from core.test_run import TestRun
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
from test_tools import fs_utils
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"):
try:
output = TestRun.executor.run(
output = TestRun.executor.run_expect_fail(
start_cmd(
cache_dev=cache_dev_1.path,
cache_id="2",
force=True,
)
)
TestRun.fail("Two caches started on same device")
except CmdException:
if not check_stderr_msg(output, start_cache_on_already_used_dev):
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"):
try:
output = TestRun.executor.run(
output = TestRun.executor.run_expect_fail(
start_cmd(
cache_dev=cache_dev_2.path,
cache_id="1",
force=True,
)
)
TestRun.fail("Two caches started with same ID")
except CmdException:
if not check_stderr_msg(output, start_cache_with_existing_id):
TestRun.fail(f"Received unexpected error message: {output.stderr}")
except CmdException:
TestRun.fail("Two caches started with same ID")
@pytest.mark.CI

View File

@ -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"):
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)
with TestRun.step("Check for running CAS cleaner"):
@ -256,7 +257,7 @@ def check_cleaning_policy_operation(
case CleaningPolicy.nop:
if (
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(
"NOP cleaning policy is not working properly! "