Add test test_cli_help_spelling

Signed-off-by: Adam Seyda <adam.seyda@intel.com>
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Adam Seyda 2022-10-03 19:43:19 +02:00 committed by Robert Baldyga
parent b6cb200307
commit 3f7cf3c670
2 changed files with 110 additions and 0 deletions

View File

@ -0,0 +1,60 @@
personal_ws-1.1 en 1
ALRU
CAS
CSV
CentOS
DSS
HDD
KiB
LANG
LBA
MiB
NHIT
NUM
NVMe
OCF
RHEL
SLES
SSD
SSDP
SUSE
TERM
TTY
UTF
Ubuntu
acp
alru
async
blk
cas
casadm
casctl
conf
config
csv
dev
failover
init
io
kibibytes
lru
metadata
namespace
namespaces
nhit
nop
nvme
opencas
param
req
reseller
resizing
runtime
sdb
sdx
utf
wa
wb
wt
wo
wwn

View File

@ -0,0 +1,50 @@
#
# Copyright(c) 2022 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
import os
from api.cas.cli import casadm_bin
from core.test_run import TestRun
def test_cli_help_spelling():
"""
title: Spelling test for 'help' command
description: Validates spelling of 'help' in CLI
pass criteria:
- no spelling mistakes are found
"""
cas_dictionary = os.path.join(TestRun.usr.repo_dir, "test", "functional", "resources")
with TestRun.step("Run aspell"):
TestRun.executor.rsync_to(
f"{cas_dictionary}/",
f"{TestRun.usr.working_dir}/",
delete=True)
cas_dictionary = os.path.join(TestRun.usr.working_dir, "cas_ex.en.pws")
output = TestRun.executor.run_expect_success(
f"{casadm_bin} -H 2>&1 | aspell list -c --lang=en_US "
f"--add-extra-dicts={cas_dictionary}")
if output.stdout:
TestRun.LOGGER.error("Misspelled words found:\n")
TestRun.LOGGER.error(output.stdout)
output = TestRun.executor.run_expect_success(
f"{casadm_bin} -H"
" | awk '/Available commands:/{ cmd=1;next } /For detailed help/ { cmd=0 } "
"cmd { print $0 }' | grep -o '\\-\\-\\S*'")
commands = output.stdout.splitlines()
for command in commands:
output = TestRun.executor.run_expect_success(
f"{casadm_bin} {command} -H | aspell list --lang=en_US "
f"--add-extra-dicts={cas_dictionary}")
if output.stdout:
TestRun.LOGGER.error(f"Misspelled word found in command :{command}\n")
TestRun.LOGGER.error(output.stdout)