From 3ff56e77dea08868af65120e34cedcd79f60de1c Mon Sep 17 00:00:00 2001 From: pskwarlo Date: Mon, 13 Jun 2022 14:01:36 +0200 Subject: [PATCH] Test for activating the same cache path Signed-off-by: Pawel Skwarlo --- ...st_standby_activate_the_same_cache_path.py | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 test/functional/tests/fault_injection/test_standby_activate_the_same_cache_path.py diff --git a/test/functional/tests/fault_injection/test_standby_activate_the_same_cache_path.py b/test/functional/tests/fault_injection/test_standby_activate_the_same_cache_path.py new file mode 100644 index 0000000..06d7690 --- /dev/null +++ b/test/functional/tests/fault_injection/test_standby_activate_the_same_cache_path.py @@ -0,0 +1,49 @@ +# +# Copyright(c) 2022 Intel Corporation +# SPDX-License-Identifier: BSD-3-Clause +# + +import pytest + +from api.cas import casadm +from api.cas.casadm_parser import get_caches +from core.test_run import TestRun +from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan +from test_utils.size import Size, Unit +from api.cas.cache_config import CacheStatus + + +@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.nand, DiskType.optane])) +@pytest.mark.require_disk("core", DiskTypeLowerThan("cache")) +def test_standby_activate_the_same_cache_path(): + """ + title: Activate the same cache path + description: | + Test for loading and activating standby cache from existing metadata. + pass_criteria: + - Successfully prepare a partition and create cache instance partition, then stop it. + - Standby cache loaded on the partition with valid CAS metadata. + - Successfully detach standby cache. + - Activate cache by path. + """ + with TestRun.step("Prepare a partition."): + cache = TestRun.disks["cache"] + cache.create_partitions([Size(200, Unit.MebiByte)]) + cache_dev = cache.partitions[0] + + with TestRun.step("Start a regular cache instance on the partition and stop it."): + cache = casadm.start_cache(cache_dev, force=True) + cache.stop() + + with TestRun.step("Load standby cache on the partition with valid CAS metadata."): + cache = casadm.standby_load(cache_dev) + + with TestRun.step("Detach standby cache"): + cache.standby_detach() + + with TestRun.step("Activate cache providing path to the partition."): + cache.standby_activate(device=cache_dev) + caches = get_caches() + cache_status = caches[0].get_status() + if cache_status != CacheStatus.running: + TestRun.LOGGER.error("Failed to activate cache with provided path.")