From 82b8d0d3231fddbed188699650be6db79087aa66 Mon Sep 17 00:00:00 2001 From: Daniel Madej Date: Tue, 15 Feb 2022 12:06:08 +0100 Subject: [PATCH] Stopping unplugged cache - changed behavior Signed-off-by: Daniel Madej --- .../recovery/test_recovery_unplug.py | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) 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 32cc6a2..d83794d 100644 --- a/test/functional/tests/lazy_writes/recovery/test_recovery_unplug.py +++ b/test/functional/tests/lazy_writes/recovery/test_recovery_unplug.py @@ -76,9 +76,19 @@ def test_recovery_unplug_cache_fs(cache_mode, cls, filesystem, direct): f"{cache.get_dirty_blocks().get_value(Unit.Blocks4096)}") with TestRun.step("Stop cache."): - cache.stop() + try: + cache.stop() + TestRun.fail("Stopping the cache should be aborted without --no-flush flag.") + except CmdException as e: + TestRun.LOGGER.info(str(e.output)) + try: + cache.stop(no_data_flush=True) + TestRun.LOGGER.warning("Expected stopping cache with errors with --no-flush flag.") + except CmdException as e1: + cli_messages.check_stderr_msg(e1.output, cli_messages.stop_cache_errors) with TestRun.step("Plug missing cache device."): + TestRun.LOGGER.info(str(casadm.list_caches(by_id_path=False))) cache_disk.plug() with TestRun.step("Load cache."): @@ -152,12 +162,18 @@ def test_recovery_unplug_cache_raw(cache_mode, cls): with TestRun.step("Stop cache."): try: - cache.stop(no_data_flush=True) - TestRun.LOGGER.warning("Expected stopping cache with errors.") + cache.stop() + TestRun.fail("Stopping the cache should be aborted without --no-flush flag.") except CmdException as e: - cli_messages.check_stderr_msg(e.output, cli_messages.stop_cache_errors) + TestRun.LOGGER.info(str(e.output)) + try: + cache.stop(no_data_flush=True) + TestRun.LOGGER.warning("Expected stopping cache with errors with --no-flush flag.") + except CmdException as e1: + cli_messages.check_stderr_msg(e1.output, cli_messages.stop_cache_errors) with TestRun.step("Plug missing cache device."): + TestRun.LOGGER.info(str(casadm.list_caches(by_id_path=False))) cache_disk.plug() with TestRun.step("Load cache."):