summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2020-09-14 15:19:34 -0600
committerEd Santiago <santiago@redhat.com>2020-09-14 15:49:28 -0600
commit2583948f72a05cf38dc9f0c4ec1feef64ab9c9af (patch)
treeafd22aba6b816495c6b764f59e84ea6c1406a192 /test
parentfd7cdb25027bb33c33eacb99f1a02838eca5d684 (diff)
downloadpodman-2583948f72a05cf38dc9f0c4ec1feef64ab9c9af.tar.gz
podman-2583948f72a05cf38dc9f0c4ec1feef64ab9c9af.tar.bz2
podman-2583948f72a05cf38dc9f0c4ec1feef64ab9c9af.zip
Usability: prevent "-l" with arguments
Add new system check confirming that "podman foo -l arg" throws an error; and fix lots of instances where code was not doing this check. I'll probably need to add something similar for --all but that can wait. Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/system/015-help.bats14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/system/015-help.bats b/test/system/015-help.bats
index 4a3781012..651fdcd09 100644
--- a/test/system/015-help.bats
+++ b/test/system/015-help.bats
@@ -86,6 +86,20 @@ function check_help() {
found[takes_no_args]=1
fi
+ # If command lists "-l, --latest" in help output, combine -l with arg.
+ # This should be disallowed with a clear message.
+ if expr "$full_help" : ".*-l, --latest" >/dev/null; then
+ local nope="exec list port ps top" # these can't be tested
+ if is_rootless; then
+ nope="$nope mount restore" # these don't work rootless
+ fi
+ if ! grep -wq "$cmd" <<<$nope; then
+ run_podman 125 "$@" $cmd -l nonexistent-container
+ is "$output" "Error: .*--latest and \(containers\|pods\|arguments\) cannot be used together" \
+ "'$command_string' with both -l and container"
+ fi
+ fi
+
# If usage has required arguments, try running without them.
# The expression here is 'first capital letter is not in [BRACKETS]'.
# It is intended to handle 'podman foo [flags] ARG' but not ' [ARG]'.