diff --git a/test/functional/api/cas/cli_messages.py b/test/functional/api/cas/cli_messages.py index 566b551..09a8d8f 100644 --- a/test/functional/api/cas/cli_messages.py +++ b/test/functional/api/cas/cli_messages.py @@ -7,7 +7,6 @@ import re from core.test_run import TestRun from test_utils.output import Output - load_inactive_core_missing = [ r"WARNING: Can not resolve path to core \d+ from cache \d+\. By-id path will be shown for that " r"core\.", @@ -18,8 +17,7 @@ start_cache_with_existing_metadata = [ r"Error inserting cache \d+", r"Old metadata found on device\.", r"Please load cache metadata using --load option or use --force to", - r" discard on-disk metadata and start fresh cache instance\.", - r"Error occurred, please see syslog \(/var/log/messages\) for details\." + r" discard on-disk metadata and start fresh cache instance\." ] error_inserting_cache = [ @@ -42,6 +40,12 @@ stop_cache_incomplete = [ r"Cache is in incomplete state - at least one core is inactive" ] +stop_cache_errors = [ + r"Error while removing cache \d+", + r"Error while writing to cache device", + r"Error occurred, please see syslog \(/var/log/messages\) for details" +] + get_stats_ioclass_id_not_configured = [ r"IO class \d+ is not configured\." ] @@ -60,6 +64,11 @@ add_cached_core = [ r"Core device \'/dev/\S+\' is already cached\." ] +already_cached_core = [ + r"Error while adding core device to cache instance \d+", + r"Device already added as a core" +] + remove_mounted_core = [ r"Can\'t remove core \d+ from cache \d+\. Device /dev/cas\d+-\d+ is mounted\!" ] diff --git a/test/functional/tests/fault_injection/test_fault_injection_with_mounted_core.py b/test/functional/tests/fault_injection/test_fault_injection_with_mounted_core.py index cff6194..df89e06 100644 --- a/test/functional/tests/fault_injection/test_fault_injection_with_mounted_core.py +++ b/test/functional/tests/fault_injection/test_fault_injection_with_mounted_core.py @@ -163,7 +163,7 @@ def test_add_cached_core(cache_mode): with TestRun.step("Try adding the same core device to the same cache for the second time."): output = TestRun.executor.run_expect_fail( cli.add_core_cmd(cache_id=str(cache1.cache_id), core_dev=str(core_part.path))) - cli_messages.check_stderr_msg(output, cli_messages.add_cached_core) + cli_messages.check_stderr_msg(output, cli_messages.already_cached_core) with TestRun.step("Stop caches."): casadm.stop_all_caches() diff --git a/test/functional/tests/lazy_writes/recovery/test_recovery_unplug.py b/test/functional/tests/lazy_writes/recovery/test_recovery_unplug.py index d5df969..f028cfe 100644 --- a/test/functional/tests/lazy_writes/recovery/test_recovery_unplug.py +++ b/test/functional/tests/lazy_writes/recovery/test_recovery_unplug.py @@ -4,12 +4,15 @@ # import os + import pytest -from api.cas import casadm + +from api.cas import casadm, cli_messages from api.cas.cache_config import CacheMode, CacheModeTrait, CacheLineSize from core.test_run import TestRun from storage_devices.disk import DiskTypeSet, DiskType, DiskTypeLowerThan from test_tools.disk_utils import Filesystem +from test_utils.output import CmdException from test_utils.size import Size, Unit from tests.lazy_writes.recovery.recovery_tests_methods import create_test_files, copy_file, \ compare_files @@ -148,7 +151,11 @@ def test_recovery_unplug_cache_raw(cache_mode, cls): f"{cache.get_dirty_blocks().get_value(Unit.Blocks4096)}") with TestRun.step("Stop cache."): - cache.stop() + try: + cache.stop(no_data_flush=True) + TestRun.LOGGER.warning("Expected stopping cache with errors.") + except CmdException as e: + cli_messages.check_stderr_msg(e.output, cli_messages.stop_cache_errors) with TestRun.step("Plug missing cache device."): cache_disk.plug()