BATS tests: start supporting podman-remote

podman-remote now supports rm! That's what we needed to start
running BATS tests.

Although most tests don't actually work, some do, and maybe
the rest will start working over time. For now, disable them.

The only significant difference found is that podman-remote
strips fractional seconds from timestamps in JSON output.
Probably not something worth caring about.

Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
Ed Santiago 2019-04-10 08:17:03 -06:00
parent 2f2c7660c3
commit 7220c166d4
11 changed files with 29 additions and 2 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,6 +7,7 @@ load helpers
@test "podman container storage is not accessible by unprivileged users" { @test "podman container storage is not accessible by unprivileged users" {
skip_if_rootless "test meaningless without suid" 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 --uidmap 0:10000:10000 $IMAGE true
run_podman run --name c_uidmap_v --uidmap 0:10000:10000 -v foo:/foo $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 "${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 # die # Abort with helpful message