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
3 changed files with 22 additions and 6 deletions

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."):
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()

View File

@@ -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()