Rebuild test for *help* command
Test all *help* call cases, even wrong. Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
This commit is contained in:
parent
24a8619f9a
commit
4b26b05b9f
@ -1,22 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright(c) 2019-2020 Intel Corporation
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
import logging
|
|
||||||
import pytest
|
|
||||||
from api.cas import casadm
|
|
||||||
|
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("shortcut", [True, False])
|
|
||||||
def test_cli_help(shortcut):
|
|
||||||
LOGGER.info("Test run")
|
|
||||||
output = casadm.help(shortcut)
|
|
||||||
LOGGER.info(output.stdout) # TODO:this is tmp, every ssh command shall be logged via executor
|
|
||||||
assert output.stdout[0:33] == "Cache Acceleration Software Linux"
|
|
||||||
# TODO: create yml config for every help command and match the output with it
|
|
||||||
# TODO: for now the assert above is purely for testing flow in the casadm api
|
|
100
test/functional/tests/cli/test_cli_help_and_version.py
Normal file
100
test/functional/tests/cli/test_cli_help_and_version.py
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
#
|
||||||
|
# Copyright(c) 2020 Intel Corporation
|
||||||
|
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||||
|
#
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from api.cas import casadm
|
||||||
|
from api.cas.cli_help_messages import *
|
||||||
|
from api.cas.cli_messages import check_stderr_msg, check_stdout_msg
|
||||||
|
from core.test_run import TestRun
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("shortcut", [True, False])
|
||||||
|
def test_cli_help(shortcut):
|
||||||
|
"""
|
||||||
|
title: Test for 'help' command.
|
||||||
|
description: Test if help for commands displays.
|
||||||
|
pass_criteria:
|
||||||
|
- Proper help displays for every command.
|
||||||
|
"""
|
||||||
|
TestRun.LOGGER.info("Run 'help' for every 'casadm' command.")
|
||||||
|
output = casadm.help(shortcut)
|
||||||
|
check_stdout_msg(output, casadm_help)
|
||||||
|
|
||||||
|
output = TestRun.executor.run("casadm" + (" -S" if shortcut else " --start-cache")
|
||||||
|
+ (" -H" if shortcut else " --help"))
|
||||||
|
check_stdout_msg(output, start_cache_help)
|
||||||
|
|
||||||
|
output = TestRun.executor.run("casadm" + (" -T" if shortcut else " --stop-cache")
|
||||||
|
+ (" -H" if shortcut else " --help"))
|
||||||
|
check_stdout_msg(output, stop_cache_help)
|
||||||
|
|
||||||
|
output = TestRun.executor.run("casadm" + (" -X" if shortcut else " --set-param")
|
||||||
|
+ (" -H" if shortcut else " --help"))
|
||||||
|
check_stdout_msg(output, set_params_help)
|
||||||
|
|
||||||
|
output = TestRun.executor.run("casadm" + (" -G" if shortcut else " --get-param")
|
||||||
|
+ (" -H" if shortcut else " --help"))
|
||||||
|
check_stdout_msg(output, get_params_help)
|
||||||
|
|
||||||
|
output = TestRun.executor.run("casadm" + (" -Q" if shortcut else " --set-cache-mode")
|
||||||
|
+ (" -H" if shortcut else " --help"))
|
||||||
|
check_stdout_msg(output, set_cache_mode_help)
|
||||||
|
|
||||||
|
output = TestRun.executor.run("casadm" + (" -A" if shortcut else " --add-core")
|
||||||
|
+ (" -H" if shortcut else " --help"))
|
||||||
|
check_stdout_msg(output, add_core_help)
|
||||||
|
|
||||||
|
output = TestRun.executor.run("casadm" + (" -R" if shortcut else " --remove-core")
|
||||||
|
+ (" -H" if shortcut else " --help"))
|
||||||
|
check_stdout_msg(output, remove_core_help)
|
||||||
|
|
||||||
|
output = TestRun.executor.run("casadm" + " --remove-detached"
|
||||||
|
+ (" -H" if shortcut else " --help"))
|
||||||
|
check_stdout_msg(output, remove_detached_help)
|
||||||
|
|
||||||
|
output = TestRun.executor.run("casadm" + (" -L" if shortcut else " --list-caches")
|
||||||
|
+ (" -H" if shortcut else " --help"))
|
||||||
|
check_stdout_msg(output, list_help)
|
||||||
|
|
||||||
|
output = TestRun.executor.run("casadm" + (" -P" if shortcut else " --stats")
|
||||||
|
+ (" -H" if shortcut else " --help"))
|
||||||
|
check_stdout_msg(output, stats_help)
|
||||||
|
|
||||||
|
output = TestRun.executor.run("casadm" + (" -Z" if shortcut else " --reset-counters")
|
||||||
|
+ (" -H" if shortcut else " --help"))
|
||||||
|
check_stdout_msg(output, reset_counters_help)
|
||||||
|
|
||||||
|
output = TestRun.executor.run("casadm" + (" -F" if shortcut else " --flush-cache")
|
||||||
|
+ (" -H" if shortcut else " --help"))
|
||||||
|
check_stdout_msg(output, flush_cache_help)
|
||||||
|
|
||||||
|
output = TestRun.executor.run("casadm" + (" -E" if shortcut else " --flush-core")
|
||||||
|
+ (" -H" if shortcut else " --help"))
|
||||||
|
check_stdout_msg(output, flush_core_help)
|
||||||
|
|
||||||
|
output = TestRun.executor.run("casadm" + (" -C" if shortcut else " --io-class")
|
||||||
|
+ (" -H" if shortcut else " --help"))
|
||||||
|
check_stdout_msg(output, ioclass_help)
|
||||||
|
|
||||||
|
output = TestRun.executor.run("casadm" + (" -N" if shortcut else " --nvme")
|
||||||
|
+ (" -H" if shortcut else " --help"))
|
||||||
|
check_stdout_msg(output, nvme_help)
|
||||||
|
|
||||||
|
output = TestRun.executor.run("casadm" + (" -V" if shortcut else " --version")
|
||||||
|
+ (" -H" if shortcut else " --help"))
|
||||||
|
check_stdout_msg(output, version_help)
|
||||||
|
|
||||||
|
output = TestRun.executor.run("casadm" + (" -H" if shortcut else " --help")
|
||||||
|
+ (" -H" if shortcut else " --help"))
|
||||||
|
check_stdout_msg(output, help_help)
|
||||||
|
|
||||||
|
output = TestRun.executor.run("casadm" + " --zero-metadata"
|
||||||
|
+ (" -H" if shortcut else " --help"))
|
||||||
|
check_stdout_msg(output, zero_metadata_help)
|
||||||
|
|
||||||
|
output = TestRun.executor.run("casadm" + (" -Y" if shortcut else " --yell")
|
||||||
|
+ (" -H" if shortcut else " --help"))
|
||||||
|
check_stderr_msg(output, unrecognized_stderr)
|
||||||
|
check_stdout_msg(output, unrecognized_stdout)
|
Loading…
Reference in New Issue
Block a user