Merge pull request #899 from karolinavelkaja/cli_messages_update_and_tests

update cli messages and tests accordingly
This commit is contained in:
Robert Baldyga 2021-08-09 20:46:37 +02:00 committed by GitHub
commit 5afc8af0e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 6 deletions

View File

@ -7,7 +7,6 @@ import re
from core.test_run import TestRun from core.test_run import TestRun
from test_utils.output import Output from test_utils.output import Output
load_inactive_core_missing = [ 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"WARNING: Can not resolve path to core \d+ from cache \d+\. By-id path will be shown for that "
r"core\.", r"core\.",
@ -18,8 +17,7 @@ start_cache_with_existing_metadata = [
r"Error inserting cache \d+", r"Error inserting cache \d+",
r"Old metadata found on device\.", r"Old metadata found on device\.",
r"Please load cache metadata using --load option or use --force to", r"Please load cache metadata using --load option or use --force to",
r" discard on-disk metadata and start fresh cache instance\.", r" discard on-disk metadata and start fresh cache instance\."
r"Error occurred, please see syslog \(/var/log/messages\) for details\."
] ]
error_inserting_cache = [ error_inserting_cache = [
@ -42,6 +40,12 @@ stop_cache_incomplete = [
r"Cache is in incomplete state - at least one core is inactive" 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 = [ get_stats_ioclass_id_not_configured = [
r"IO class \d+ is not configured\." r"IO class \d+ is not configured\."
] ]
@ -60,6 +64,11 @@ add_cached_core = [
r"Core device \'/dev/\S+\' is already cached\." 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 = [ remove_mounted_core = [
r"Can\'t remove core \d+ from cache \d+\. Device /dev/cas\d+-\d+ is mounted\!" r"Can\'t remove core \d+ from cache \d+\. Device /dev/cas\d+-\d+ is mounted\!"
] ]

View File

@ -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."): with TestRun.step("Try adding the same core device to the same cache for the second time."):
output = TestRun.executor.run_expect_fail( output = TestRun.executor.run_expect_fail(
cli.add_core_cmd(cache_id=str(cache1.cache_id), core_dev=str(core_part.path))) 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."): with TestRun.step("Stop caches."):
casadm.stop_all_caches() casadm.stop_all_caches()

View File

@ -4,12 +4,15 @@
# #
import os import os
import pytest import pytest
from api.cas import casadm
from api.cas import casadm, cli_messages
from api.cas.cache_config import CacheMode, CacheModeTrait, CacheLineSize from api.cas.cache_config import CacheMode, CacheModeTrait, CacheLineSize
from core.test_run import TestRun from core.test_run import TestRun
from storage_devices.disk import DiskTypeSet, DiskType, DiskTypeLowerThan from storage_devices.disk import DiskTypeSet, DiskType, DiskTypeLowerThan
from test_tools.disk_utils import Filesystem from test_tools.disk_utils import Filesystem
from test_utils.output import CmdException
from test_utils.size import Size, Unit from test_utils.size import Size, Unit
from tests.lazy_writes.recovery.recovery_tests_methods import create_test_files, copy_file, \ from tests.lazy_writes.recovery.recovery_tests_methods import create_test_files, copy_file, \
compare_files compare_files
@ -148,7 +151,11 @@ def test_recovery_unplug_cache_raw(cache_mode, cls):
f"{cache.get_dirty_blocks().get_value(Unit.Blocks4096)}") f"{cache.get_dirty_blocks().get_value(Unit.Blocks4096)}")
with TestRun.step("Stop cache."): 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."): with TestRun.step("Plug missing cache device."):
cache_disk.plug() cache_disk.plug()