mirror of
https://github.com/containers/podman.git
synced 2025-06-23 02:18:13 +08:00
system tests: authfile-exists: minor cleanup
Quick followup to #19348: - refactor into table form, for legibility - add tests for 'podman kube play' and 'podman run' - slightly cleaner message on failure Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@ -1158,35 +1158,46 @@ EOF
|
|||||||
run_podman rm -f -t0 $ctr
|
run_podman rm -f -t0 $ctr
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "podman --authfile=/tmp/bogus " {
|
@test "podman --authfile=nonexistent-path" {
|
||||||
|
# List of commands to be tested. These all share a common authfile check.
|
||||||
|
#
|
||||||
|
# Table format is:
|
||||||
|
# podman command | arguments | '-' if it does not work with podman-remote
|
||||||
|
tests="
|
||||||
|
auto-update | | -
|
||||||
|
build | $PODMAN_TMPDIR |
|
||||||
|
container runlabel | $IMAGE argument | -
|
||||||
|
create | $IMAGE argument |
|
||||||
|
image sign | $IMAGE | -
|
||||||
|
kube play | argument |
|
||||||
|
logout | $IMAGE |
|
||||||
|
manifest add | $IMAGE argument |
|
||||||
|
manifest inspect | $IMAGE |
|
||||||
|
manifest push | $IMAGE argument |
|
||||||
|
pull | $IMAGE argument |
|
||||||
|
push | $IMAGE argument |
|
||||||
|
run | $IMAGE argument |
|
||||||
|
search | $IMAGE |
|
||||||
|
"
|
||||||
|
|
||||||
bogus=$PODMAN_TMPDIR/bogus-authfile
|
bogus=$PODMAN_TMPDIR/bogus-authfile
|
||||||
for command in "run" "create" "pull" "push" "manifest push" "manifest add" "container runlabel"; do
|
|
||||||
if is_remote -a $command -eq "container runlabel"; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
run_podman 125 $command --authfile=$bogus $IMAGE argument
|
|
||||||
is "$output" "Error: checking authfile: stat $bogus: no such file or directory" "$command should fail with not such file"
|
|
||||||
done
|
|
||||||
|
|
||||||
for command in "search" "manifest inspect" "logout" "image sign"; do
|
|
||||||
if is_remote -a $command -eq "image sign"; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
run_podman 125 $command --authfile=$bogus $IMAGE
|
|
||||||
is "$output" "Error: checking authfile: stat $bogus: no such file or directory" "$command should fail with not such file"
|
|
||||||
done
|
|
||||||
|
|
||||||
if !is_remote; then
|
|
||||||
for command in "auto-update"; do
|
|
||||||
run_podman 125 $command --authfile=$bogus
|
|
||||||
is "$output" "Error: checking authfile: stat $bogus: no such file or directory" "$command should fail with not such file"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
touch $PODMAN_TMPDIR/Containerfile
|
touch $PODMAN_TMPDIR/Containerfile
|
||||||
run_podman 125 build --authfile=$bogus $PODMAN_TMPDIR
|
|
||||||
is "$output" "Error: checking authfile: stat $bogus: no such file or directory" "build should fail with not such file"
|
while read command args local_only;do
|
||||||
|
# skip commands that don't work in podman-remote
|
||||||
|
if [[ "$local_only" = "-" ]]; then
|
||||||
|
if is_remote; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# parse_table gives us '' (two single quotes) for empty columns
|
||||||
|
if [[ "$args" = "''" ]]; then args=;fi
|
||||||
|
|
||||||
|
run_podman 125 $command --authfile=$bogus $args
|
||||||
|
assert "$output" = "Error: checking authfile: stat $bogus: no such file or directory" \
|
||||||
|
"$command --authfile=nonexistent-path"
|
||||||
|
done < <(parse_table "$tests")
|
||||||
}
|
}
|
||||||
|
|
||||||
# vim: filetype=sh
|
# vim: filetype=sh
|
||||||
|
Reference in New Issue
Block a user