summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2020-04-29 10:03:12 -0600
committerbaude <bbaude@redhat.com>2020-04-30 14:55:10 -0500
commit91a42fefcbd5372c8701f5a0f5d6da85216cc465 (patch)
treeaca204c20b52a0911ad3bd4ec9371bf026b92ce9 /test
parentc31bf2e97644b76163624149bb130528c6a5a394 (diff)
downloadpodman-91a42fefcbd5372c8701f5a0f5d6da85216cc465.tar.gz
podman-91a42fefcbd5372c8701f5a0f5d6da85216cc465.tar.bz2
podman-91a42fefcbd5372c8701f5a0f5d6da85216cc465.zip
System tests: help messages: check required-arg
If a usage message is of the form '... [flags] ARGNAME', where ARGNAME is all-caps and not in brackets, it must be a required argument. Try running podman subcommand without ARGNAME, and make sure that podman bails out with an informative message. (Since this message is freeform in each subcommand, not Cobra-generated, we have a lot of possible variations to check for). Fix podman login/logout Use messages to indicate that REGISTRY is now optional (as of #5233). This test has actually been in place for over a year but due to a typo on my part -- a missing space -- it was not being run. "For want of a space, much testing was lost". Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/system/015-help.bats21
1 files changed, 17 insertions, 4 deletions
diff --git a/test/system/015-help.bats b/test/system/015-help.bats
index fd4be87b2..231e52195 100644
--- a/test/system/015-help.bats
+++ b/test/system/015-help.bats
@@ -55,11 +55,24 @@ function check_help() {
# If usage has required arguments, try running without them
if expr "$usage" : '.*\[flags\] [A-Z]' >/dev/null; then
- if [ "$cmd" != "stats"]; then
- dprint "podman $@ $cmd (without required args)"
- run_podman 125 "$@" $cmd
- is "$output" "Error:"
+ # Exceptions: these commands don't work rootless
+ if is_rootless; then
+ # "pause is not supported for rootless containers"
+ if [ "$cmd" = "pause" -o "$cmd" = "unpause" ]; then
+ continue
+ fi
+ # "network rm" too
+ if [ "$@" = "network" -a "$cmd" = "rm" ]; then
+ continue
+ fi
fi
+
+ # The </dev/null protects us from 'podman login' which will
+ # try to read username/password from stdin.
+ dprint "podman $@ $cmd (without required args)"
+ run_podman 125 "$@" $cmd </dev/null
+ is "$output" "Error:.* \(require\|specif\|must\|provide\|need\|choose\)" \
+ "'podman $@ $cmd' without required arg"
fi
count=$(expr $count + 1)