diff options
author | Ed Santiago <santiago@redhat.com> | 2019-03-07 15:15:50 -0700 |
---|---|---|
committer | Ed Santiago <santiago@redhat.com> | 2019-03-18 15:21:52 -0600 |
commit | 58d2e589fb4dbcc23cfc5ddd3f886a32a0ab759e (patch) | |
tree | 647f839b8dda979e8526f6aa335d4bc2c52ff468 /test/system/015-help.bats | |
parent | 07e10d9dd6c0c0828637f770234266daa182fc95 (diff) | |
download | podman-58d2e589fb4dbcc23cfc5ddd3f886a32a0ab759e.tar.gz podman-58d2e589fb4dbcc23cfc5ddd3f886a32a0ab759e.tar.bz2 podman-58d2e589fb4dbcc23cfc5ddd3f886a32a0ab759e.zip |
BATS: new tests, and improvements to existing ones
New:
- podman exec
- podman load (requires #2674)
- CLI parsing (regression test for #2574)
Improved:
- help: test "podman NoSuchCommand", and subcommands
- help: test "podman cmd" without required args
- pod: start with --infra=false; this allows running rootless
- log: also run 'logs' after container is run
- log: test -f with two containers
Also, use helpful descriptions for skip_if_rootless
Tested on f29, root and rootless. As soon as podman-remote
supports rm, I'll start testing that too.
Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/system/015-help.bats')
-rw-r--r-- | test/system/015-help.bats | 19 |
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 ] || \ |