summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-09-15 19:58:19 +0200
committerGitHub <noreply@github.com>2020-09-15 19:58:19 +0200
commite7af517914600a97fac4e0341bb701aa178fbbb5 (patch)
tree4b34d10a5afe3a268967a696dfb885868608e09b /test
parent46280d6aba13af7a0b8173adb96c54afdd560da7 (diff)
parent2583948f72a05cf38dc9f0c4ec1feef64ab9c9af (diff)
downloadpodman-e7af517914600a97fac4e0341bb701aa178fbbb5.tar.gz
podman-e7af517914600a97fac4e0341bb701aa178fbbb5.tar.bz2
podman-e7af517914600a97fac4e0341bb701aa178fbbb5.zip
Merge pull request #7633 from edsantiago/minus_l_with_other_args
Usability: prevent "-l" with arguments
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]'.