Merge pull request #2889 from edsantiago/bats

BATS tests: start supporting podman-remote
This commit is contained in:
OpenShift Merge Robot
2019-04-11 19:19:23 -07:00
committed by GitHub
11 changed files with 29 additions and 2 deletions

View File

@ -3,6 +3,8 @@
load helpers
@test "podman info - basic test" {
skip_if_remote
run_podman info
expected_keys="
@ -26,6 +28,8 @@ RunRoot:
}
@test "podman info - json" {
skip_if_remote
run_podman info --format=json
expr_nvr="[a-z0-9-]\\\+-[a-z0-9.]\\\+-[a-z0-9]\\\+\."

View File

@ -25,11 +25,12 @@ load helpers
@test "podman images - json" {
# 'created': podman includes fractional seconds, podman-remote does not
tests="
names[0] | $PODMAN_TEST_IMAGE_FQN
id | [0-9a-f]\\\{64\\\}
digest | sha256:[0-9a-f]\\\{64\\\}
created | [0-9-]\\\+T[0-9:]\\\+\\\.[0-9]\\\+Z
created | [0-9-]\\\+T[0-9:.]\\\+Z
size | [0-9]\\\+
"

View File

@ -87,6 +87,8 @@ function check_help() {
@test "podman help - basic tests" {
skip_if_remote
# Called with no args -- start with 'podman --help'. check_help() will
# recurse for any subcommands.
check_help

View File

@ -3,6 +3,8 @@
load helpers
@test "podman run - basic tests" {
skip_if_remote
rand=$(random_string 30)
tests="
true | 0 |

View File

@ -6,6 +6,8 @@
load helpers
@test "podman logs - basic test" {
skip_if_remote
rand_string=$(random_string 40)
run_podman create $IMAGE echo $rand_string

View File

@ -6,6 +6,7 @@ load helpers
@test "podman mount - basic test" {
# Only works with root (FIXME: does it work with rootless + vfs?)
skip_if_rootless "mount does not work rootless"
skip_if_remote
f_path=/tmp/tmpfile_$(random_string 8)
f_content=$(random_string 30)

View File

@ -6,6 +6,8 @@
load helpers
@test "podman build - basic test" {
skip_if_remote
rand_filename=$(random_string 20)
rand_content=$(random_string 50)

View File

@ -6,6 +6,8 @@
load helpers
@test "podman exec - basic test" {
skip_if_remote
rand_filename=$(random_string 20)
rand_content=$(random_string 50)

View File

@ -24,7 +24,7 @@ load helpers
@test "podman history - json" {
tests="
id | [0-9a-f]\\\{64\\\}
created | [0-9-]\\\+T[0-9:]\\\+\\\.[0-9]\\\+Z
created | [0-9-]\\\+T[0-9:.]\\\+Z
size | -\\\?[0-9]\\\+
"

View File

@ -7,6 +7,7 @@ load helpers
@test "podman container storage is not accessible by unprivileged users" {
skip_if_rootless "test meaningless without suid"
skip_if_remote
run_podman run --name c_uidmap --uidmap 0:10000:10000 $IMAGE true
run_podman run --name c_uidmap_v --uidmap 0:10000:10000 -v foo:/foo $IMAGE true

View File

@ -225,6 +225,16 @@ function skip_if_rootless() {
skip "${1:-not applicable under rootless podman}"
}
####################
# skip_if_remote # ...with an optional message
####################
function skip_if_remote() {
if [[ ! "$PODMAN" =~ -remote ]]; then
return
fi
skip "${1:-test does not work with podman-remote}"
}
#########
# die # Abort with helpful message