summaryrefslogtreecommitdiff
path: root/test/system/015-help.bats
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-03-19 09:12:27 -0700
committerGitHub <noreply@github.com>2019-03-19 09:12:27 -0700
commit537c382f5bd098bc89a457554db9bd0b08eab3c2 (patch)
tree649331a8c1b88393f07fe061390e5ca8a51b2007 /test/system/015-help.bats
parenta1299f506d9b93824fae737f0f68a19adaf2bde1 (diff)
parent58d2e589fb4dbcc23cfc5ddd3f886a32a0ab759e (diff)
downloadpodman-537c382f5bd098bc89a457554db9bd0b08eab3c2.tar.gz
podman-537c382f5bd098bc89a457554db9bd0b08eab3c2.tar.bz2
podman-537c382f5bd098bc89a457554db9bd0b08eab3c2.zip
Merge pull request #2703 from edsantiago/bats
BATS: new tests, and improvements to existing ones
Diffstat (limited to 'test/system/015-help.bats')
-rw-r--r--test/system/015-help.bats19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/system/015-help.bats b/test/system/015-help.bats
index b648599f7..8e07b8822 100644
--- a/test/system/015-help.bats
+++ b/test/system/015-help.bats
@@ -46,15 +46,34 @@ function check_help() {
# Confirm that by running with 'invalid-arg' and expecting failure.
if expr "$usage" : '.*\[flags\]$' >/dev/null; then
if [ "$cmd" != "help" ]; then
+ dprint "podman $@ $cmd invalid-arg"
run_podman 125 "$@" $cmd invalid-arg
is "$output" "Error: .* takes no arguments" \
"'podman $@ $cmd' with extra (invalid) arguments"
fi
fi
+ # If usage has required arguments, try running without them
+ if expr "$usage" : '.*\[flags\] [A-Z]' >/dev/null; then
+ dprint "podman $@ $cmd (without required args)"
+ run_podman 125 "$@" $cmd
+ is "$output" "Error:"
+ fi
+
count=$(expr $count + 1)
done
+ # Any command that takes subcommands, must throw error if called
+ # without one.
+ dprint "podman $@"
+ run_podman 125 "$@"
+ is "$output" "Error: missing command .*$@ COMMAND"
+
+ # Assume that 'NoSuchCommand' is not a command
+ dprint "podman $@ NoSuchCommand"
+ run_podman 125 "$@" NoSuchCommand
+ is "$output" "Error: unrecognized command .*$@ NoSuchCommand"
+
# This can happen if the output of --help changes, such as between
# the old command parser and cobra.
[ $count -gt 0 ] || \