Add test for 'version' command
Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
This commit is contained in:
parent
4b26b05b9f
commit
5ece6efa40
@ -4,7 +4,10 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
import re
|
||||||
|
|
||||||
from api.cas import casadm
|
from api.cas import casadm
|
||||||
|
from api.cas.casadm_params import OutputFormat
|
||||||
from api.cas.cli_help_messages import *
|
from api.cas.cli_help_messages import *
|
||||||
from api.cas.cli_messages import check_stderr_msg, check_stdout_msg
|
from api.cas.cli_messages import check_stderr_msg, check_stdout_msg
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
@ -98,3 +101,30 @@ def test_cli_help(shortcut):
|
|||||||
+ (" -H" if shortcut else " --help"))
|
+ (" -H" if shortcut else " --help"))
|
||||||
check_stderr_msg(output, unrecognized_stderr)
|
check_stderr_msg(output, unrecognized_stderr)
|
||||||
check_stdout_msg(output, unrecognized_stdout)
|
check_stdout_msg(output, unrecognized_stdout)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("output_format", OutputFormat)
|
||||||
|
@pytest.mark.parametrize("shortcut", [True, False])
|
||||||
|
def test_cli_version(shortcut, output_format):
|
||||||
|
"""
|
||||||
|
title: Test for 'version' command.
|
||||||
|
description: Test if version displays.
|
||||||
|
pass_criteria:
|
||||||
|
- Proper OCL's components names displays in table with its versions.
|
||||||
|
"""
|
||||||
|
TestRun.LOGGER.info("Check OCL's version.")
|
||||||
|
output = casadm.print_version(output_format, shortcut).stdout
|
||||||
|
TestRun.LOGGER.info(output)
|
||||||
|
if not names_in_output(output) or not versions_in_output(output):
|
||||||
|
TestRun.fail("'Version' command failed.")
|
||||||
|
|
||||||
|
|
||||||
|
def names_in_output(output):
|
||||||
|
return ("CAS Cache Kernel Module" in output
|
||||||
|
and "CAS Disk Kernel Module" in output
|
||||||
|
and "CAS CLI Utility" in output)
|
||||||
|
|
||||||
|
|
||||||
|
def versions_in_output(output):
|
||||||
|
version_pattern = re.compile(r"(\d){2}\.(\d){2}\.(\d){2}\.(\d){8}")
|
||||||
|
return len(version_pattern.findall(output)) == 3
|
||||||
|
Loading…
Reference in New Issue
Block a user