diff --git a/test/functional/resources/cas_ex.en.pws b/test/functional/resources/cas_ex.en.pws new file mode 100644 index 0000000..37cfffe --- /dev/null +++ b/test/functional/resources/cas_ex.en.pws @@ -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 diff --git a/test/functional/tests/cli/test_cli_help_spelling.py b/test/functional/tests/cli/test_cli_help_spelling.py new file mode 100644 index 0000000..aacdbf8 --- /dev/null +++ b/test/functional/tests/cli/test_cli_help_spelling.py @@ -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)