From ed93873bd85c9a6a735583c18505171509a48243 Mon Sep 17 00:00:00 2001 From: Karolina Rogowska Date: Wed, 27 Jul 2022 16:33:00 +0200 Subject: [PATCH] fix test_cli_help Signed-off-by: Karolina Rogowska --- test/functional/api/cas/cli_help_messages.py | 41 ++++++++++++++++--- test/functional/api/cas/cli_messages.py | 1 + .../tests/cli/test_cli_help_and_version.py | 9 +++- 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/test/functional/api/cas/cli_help_messages.py b/test/functional/api/cas/cli_help_messages.py index 02e7df5..dfe36f6 100644 --- a/test/functional/api/cas/cli_help_messages.py +++ b/test/functional/api/cas/cli_help_messages.py @@ -1,5 +1,5 @@ # -# Copyright(c) 2020-2021 Intel Corporation +# Copyright(c) 2020-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -13,7 +13,8 @@ casadm_help = [ r"-G --get-param Get various runtime parameters", r"-Q --set-cache-mode Set cache mode", r"-A --add-core Add core device to cache instance", - r"-R --remove-core Remove core device from cache instance", + r"-R --remove-core Remove active core device from cache instance", + r"--remove-inactive Remove inactive core device from cache instance", r"--remove-detached Remove core device from core pool", r"-L --list-caches List all cache instances and core devices", r"-P --stats Print statistics for cache instance", @@ -24,6 +25,7 @@ casadm_help = [ r"-C --io-class Manage IO classes", r"-V --version Print CAS version", r"-H --help Print help", + r"--standby Manage failover standby", r"--zero-metadata Clear metadata from caching device", r"For detailed help on the above commands use --help after the command\.", r"e\.g\.", @@ -114,12 +116,12 @@ remove_detached_help = [ remove_core_help = [ r"Usage: casadm --remove-core --cache-id \ --core-id \ \[option\.\.\.\]", - r"Remove core device from cache instance", + r"Remove active core device from cache instance", r"Options that are valid with --remove-core \(-R\) are:", r"-i --cache-id \ Identifier of cache instance \<1-16384\>", r"-j --core-id \ Identifier of core \<0-4095\> within given cache " r"instance", - r"-f --force Force remove inactive core" + r"-f --force Force active core removal without data flush" ] add_core_help = [ @@ -249,11 +251,38 @@ start_cache_help = [ r"\{4,8,16,32,64\}\[KiB\] \(default: 4\)" ] +standby_help = [ + r"Usage: casadm --standby \{--init|--load|--detach|--activate\}", + r"Manage failover standby", + r"Initialize cache in standby mode:", + r"Usage: casadm --standby --init --cache-id \ --cache-line-size \ " + r"--cache-device \ \[option...\]", + r"Options that are valid with --init are:", + r"-i --cache-id \ Identifier of cache instance \<1-16384\>", + r"-x --cache-line-size \ Set cache line size in kibibytes: \{4,8,16,32,64\}" + r"\[KiB\] \(default: 4\)", + r"-d --cache-device \ Caching device to be used", + r"-f --force Force the initialization of cache instance", + r"Load cache in standby mode:", + r"Usage: casadm --standby --load --cache-device \", + r"Options that are valid with --load are:", + r"-d --cache-device \ Caching device to be used", + r"Detach cache device in standby mode:", + r"Usage: casadm --standby --detach --cache-id \", + r"Options that are valid with --detach are:", + r" -i --cache-id \ Identifier of cache instance \<1-16384\>", + r"Activate standby cache:", + r"Usage: casadm --standby --activate --cache-id \ --cache-device \", + r"Options that are valid with --activate are:", + r"-i --cache-id \ Identifier of cache instance \<1-16384\>", + r"-d --cache-device \ Caching device to be used" +] + zero_metadata_help = [ - r"Usage: casadm --zero-metadata --device \", + r"Usage: casadm --zero-metadata --device \ \[option...\]", r"Clear metadata from caching device", r"Options that are valid with --zero-metadata are:", - r"-d --device \ Path to device on which metadata would be cleared" + r"-d --device \ Path to device on which metadata would be cleared", r"-f --force Ignore potential dirty data on cache device" ] diff --git a/test/functional/api/cas/cli_messages.py b/test/functional/api/cas/cli_messages.py index 665fa81..c071554 100644 --- a/test/functional/api/cas/cli_messages.py +++ b/test/functional/api/cas/cli_messages.py @@ -2,6 +2,7 @@ # Copyright(c) 2019-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # + import re from core.test_run import TestRun diff --git a/test/functional/tests/cli/test_cli_help_and_version.py b/test/functional/tests/cli/test_cli_help_and_version.py index 60462bd..8f9436f 100644 --- a/test/functional/tests/cli/test_cli_help_and_version.py +++ b/test/functional/tests/cli/test_cli_help_and_version.py @@ -1,11 +1,12 @@ # -# Copyright(c) 2020-2021 Intel Corporation +# Copyright(c) 2020-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # -import pytest import re +import pytest + from api.cas import casadm from api.cas.casadm_params import OutputFormat from api.cas.cli_help_messages import * @@ -89,6 +90,10 @@ def test_cli_help(shortcut): + (" -H" if shortcut else " --help")) check_stdout_msg(output, help_help) + output = TestRun.executor.run("casadm" + " --standby" + + (" -H" if shortcut else " --help")) + check_stdout_msg(output, standby_help) + output = TestRun.executor.run("casadm" + " --zero-metadata" + (" -H" if shortcut else " --help")) check_stdout_msg(output, zero_metadata_help)