summaryrefslogtreecommitdiff
path: root/test/system/015-help.bats
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2022-04-13 14:07:57 -0600
committerEd Santiago <santiago@redhat.com>2022-04-13 14:09:24 -0600
commit9ef745d5413c9a403e8c5dbb2fcbac4b11511a7c (patch)
tree503dcf9bd4a9927d192e4c75cdd7598b3f5aafde /test/system/015-help.bats
parent480bc83b804467086e0878653d87bf51a4791980 (diff)
downloadpodman-9ef745d5413c9a403e8c5dbb2fcbac4b11511a7c.tar.gz
podman-9ef745d5413c9a403e8c5dbb2fcbac4b11511a7c.tar.bz2
podman-9ef745d5413c9a403e8c5dbb2fcbac4b11511a7c.zip
System tests: Usage checks: better error messages
Current error messages are really awful, and cause great suffering every time someone adds a new subcommand. Let's see if these are better. Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/system/015-help.bats')
-rw-r--r--test/system/015-help.bats15
1 files changed, 9 insertions, 6 deletions
diff --git a/test/system/015-help.bats b/test/system/015-help.bats
index a87081687..4eeea85bf 100644
--- a/test/system/015-help.bats
+++ b/test/system/015-help.bats
@@ -68,9 +68,10 @@ function check_help() {
if [ "$cmd" != "help" ]; then
dprint "$command_string invalid-arg"
run_podman '?' "$@" $cmd invalid-arg
- is "$status" 125 "'$command_string invalid-arg' - exit status"
+ is "$status" 125 \
+ "'$usage' indicates that the command takes no arguments. I invoked it with 'invalid-arg' and expected an error status"
is "$output" "Error: .* takes no arguments" \
- "'$command_string' with extra (invalid) arguments"
+ "'$usage' indicates that the command takes no arguments. I invoked it with 'invalid-arg' and expected the following error message"
fi
found[takes_no_args]=1
fi
@@ -115,9 +116,10 @@ function check_help() {
# try to read username/password from stdin.
dprint "$command_string (without required args)"
run_podman '?' "$@" $cmd </dev/null
- is "$status" 125 "'$command_string' with no arguments - exit status"
+ is "$status" 125 \
+ "'$usage' indicates at least one required arg. I invoked it with no args and expected an error exit code"
is "$output" "Error:.* \(require\|specif\|must\|provide\|need\|choose\|accepts\)" \
- "'$command_string' without required arg"
+ "'$usage' indicates at least one required arg. I invoked it with no args and expected one of these error messages"
found[required_args]=1
fi
@@ -138,9 +140,10 @@ function check_help() {
local n_args=$(wc -w <<<"$rhs")
run_podman '?' "$@" $cmd $(seq --format='x%g' 0 $n_args)
- is "$status" 125 "'$command_string' with >$n_args arguments - exit status"
+ is "$status" 125 \
+ "'$usage' indicates a maximum of $n_args args. I invoked it with more, and expected this exit status"
is "$output" "Error:.* \(takes no arguments\|requires exactly $n_args arg\|accepts at most\|too many arguments\|accepts $n_args arg(s), received\|accepts between .* and .* arg(s), received \)" \
- "'$command_string' with >$n_args arguments"
+ "'$usage' indicates a maximum of $n_args args. I invoked it with more, and expected one of these error messages"
found[fixed_args]=1
fi