diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/podman_attach.bats | 6 | ||||
-rw-r--r-- | test/podman_commit.bats | 72 | ||||
-rw-r--r-- | test/podman_diff.bats | 1 | ||||
-rw-r--r-- | test/podman_export.bats | 6 | ||||
-rw-r--r-- | test/podman_images.bats | 2 | ||||
-rw-r--r-- | test/podman_inspect.bats | 6 | ||||
-rw-r--r-- | test/podman_kill.bats | 36 | ||||
-rw-r--r-- | test/podman_load.bats | 32 | ||||
-rw-r--r-- | test/podman_logs.bats | 18 | ||||
-rw-r--r-- | test/podman_mount.bats | 10 | ||||
-rw-r--r-- | test/podman_networking.bats | 40 | ||||
-rw-r--r-- | test/podman_pause.bats | 48 | ||||
-rw-r--r-- | test/podman_ps.bats | 78 | ||||
-rw-r--r-- | test/podman_pull.bats | 42 | ||||
-rw-r--r-- | test/podman_push.bats | 16 | ||||
-rw-r--r-- | test/podman_rm.bats | 6 | ||||
-rw-r--r-- | test/podman_run.bats | 45 | ||||
-rw-r--r-- | test/podman_run_cpu.bats | 71 | ||||
-rw-r--r-- | test/podman_run_dns.bats | 56 | ||||
-rw-r--r-- | test/podman_run_memory.bats | 39 | ||||
-rw-r--r-- | test/podman_save.bats | 12 | ||||
-rw-r--r-- | test/podman_stop.bats | 28 | ||||
-rw-r--r-- | test/podman_tag.bats | 18 | ||||
-rw-r--r-- | test/podman_top.bats | 6 | ||||
-rw-r--r-- | test/podman_version.bats | 2 |
25 files changed, 446 insertions, 250 deletions
diff --git a/test/podman_attach.bats b/test/podman_attach.bats index 8676b2e43..605a44789 100644 --- a/test/podman_attach.bats +++ b/test/podman_attach.bats @@ -11,14 +11,14 @@ function setup() { } @test "attach to a bogus container" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} attach foobar" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} attach foobar echo "$output" [ "$status" -eq 125 ] } @test "attach to non-running container" { ${PODMAN_BINARY} ${PODMAN_OPTIONS} create --name foobar -d -i ${ALPINE} ls - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} attach foobar" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} attach foobar echo "$output" [ "$status" -eq 125 ] } @@ -26,7 +26,7 @@ function setup() { @test "attach to multiple containers" { ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name foobar1 -d -i ${ALPINE} /bin/sh ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name foobar2 -d -i ${ALPINE} /bin/sh - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} attach foobar1 foobar2" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} attach foobar1 foobar2 echo "$output" [ "$status" -eq 125 ] } diff --git a/test/podman_commit.bats b/test/podman_commit.bats index 9257743e9..45c2b010e 100644 --- a/test/podman_commit.bats +++ b/test/podman_commit.bats @@ -13,109 +13,85 @@ function setup() { } @test "podman commit default" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d --name my_ctr ${FEDORA_MINIMAL} sleep 6000" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} commit my_ctr image-committed" + ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d --name my_ctr ${FEDORA_MINIMAL} sleep 6000 + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} commit my_ctr image-committed echo "$output" [ "$status" -eq 0 ] run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} images | grep image-committed" echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi image-committed" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop my_ctr" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi image-committed echo "$output" [ "$status" -eq 0 ] + ${PODMAN_BINARY} ${PODMAN_OPTIONS} stop my_ctr } @test "podman commit with message flag" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d --name my_ctr ${FEDORA_MINIMAL} sleep 6000" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} commit --message testing-commit my_ctr image-committed" + ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d --name my_ctr ${FEDORA_MINIMAL} sleep 6000 + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} commit --message testing-commit my_ctr image-committed echo "$output" [ "$status" -eq 0 ] run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect image-committed | grep testing-commit" echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi image-committed" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop my_ctr" + ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi image-committed echo "$output" [ "$status" -eq 0 ] + ${PODMAN_BINARY} ${PODMAN_OPTIONS} stop my_ctr } @test "podman commit with author flag" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d --name my_ctr ${FEDORA_MINIMAL} sleep 6000" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} commit --author author-name my_ctr image-committed" + ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d --name my_ctr ${FEDORA_MINIMAL} sleep 6000 + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} commit --author author-name my_ctr image-committed echo "$output" [ "$status" -eq 0 ] run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect image-committed | grep author-name" echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi image-committed" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop my_ctr" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi image-committed echo "$output" [ "$status" -eq 0 ] + ${PODMAN_BINARY} ${PODMAN_OPTIONS} stop my_ctr } @test "podman commit with change flag" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d --name my_ctr ${FEDORA_MINIMAL} sleep 6000" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} commit --change LABEL=image=blue my_ctr image-committed" + ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d --name my_ctr ${FEDORA_MINIMAL} sleep 6000 + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} commit --change LABEL=image=blue my_ctr image-committed echo "$output" [ "$status" -eq 0 ] run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect image-committed | grep blue" echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi image-committed" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop my_ctr" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi image-committed echo "$output" [ "$status" -eq 0 ] + ${PODMAN_BINARY} ${PODMAN_OPTIONS} stop my_ctr } @test "podman commit with pause flag" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d --name my_ctr ${FEDORA_MINIMAL} sleep 6000" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} commit --pause=false my_ctr image-committed" + ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d --name my_ctr ${FEDORA_MINIMAL} sleep 6000 + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} commit --pause=false my_ctr image-committed echo "$output" [ "$status" -eq 0 ] run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} images | grep image-committed" echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi image-committed" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop my_ctr" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi image-committed echo "$output" [ "$status" -eq 0 ] + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} stop my_ctr } @test "podman commit non-running container" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} create --name my_ctr ${FEDORA_MINIMAL} ls" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} commit my_ctr image-committed" + ${PODMAN_BINARY} ${PODMAN_OPTIONS} create --name my_ctr ${FEDORA_MINIMAL} ls + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} commit my_ctr image-committed echo "$output" [ "$status" -eq 0 ] run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} images | grep image-committed" echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi image-committed" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm my_ctr" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi image-committed echo "$output" [ "$status" -eq 0 ] + ${PODMAN_BINARY} ${PODMAN_OPTIONS} rm my_ctr } diff --git a/test/podman_diff.bats b/test/podman_diff.bats index 9ed088807..ed1a17309 100644 --- a/test/podman_diff.bats +++ b/test/podman_diff.bats @@ -23,7 +23,6 @@ function teardown() { } @test "test diff with json output" { - # run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} diff --format json $IMAGE | python -m json.tool" run ${PODMAN_BINARY} $PODMAN_OPTIONS diff --format json $BB echo "$output" [ "$status" -eq 0 ] diff --git a/test/podman_export.bats b/test/podman_export.bats index 3847ab14c..40fc7bb4f 100644 --- a/test/podman_export.bats +++ b/test/podman_export.bats @@ -11,14 +11,14 @@ function setup() { } @test "podman export output flag" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} create $BB ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create $BB ls echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} export -o container.tar $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} export -o container.tar $ctr_id echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rm $ctr_id echo "$output" [ "$status" -eq 0 ] rm -f container.tar diff --git a/test/podman_images.bats b/test/podman_images.bats index 3ea8af793..5812e8f8b 100644 --- a/test/podman_images.bats +++ b/test/podman_images.bats @@ -10,7 +10,7 @@ function setup() { copy_images } @test "podman images" { - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} images + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} images echo "$output" [ "$status" -eq 0 ] } diff --git a/test/podman_inspect.bats b/test/podman_inspect.bats index 9f9336f48..19e5a0a9b 100644 --- a/test/podman_inspect.bats +++ b/test/podman_inspect.bats @@ -23,11 +23,11 @@ function setup() { } @test "podman inspect with format" { - run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS inspect --format {{.ID}} ${ALPINE} + run ${PODMAN_BINARY} $PODMAN_OPTIONS inspect --format {{.ID}} ${ALPINE} echo "$output" [ "$status" -eq 0 ] inspectOutput="$output" - run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS images --no-trunc --quiet ${ALPINE} + bash -c run ${PODMAN_BINARY} $PODMAN_OPTIONS images --no-trunc --quiet ${ALPINE} | sed -e 's/sha256://g' echo "$output" [ "$status" -eq 0 ] [ "$output" = "$inspectOutput" ] @@ -42,7 +42,7 @@ function setup() { } @test "podman inspect container with size" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} create ${BB} ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create ${BB} ls echo "$output" [ "$status" -eq 0 ] run bash -c "${PODMAN_BINARY} $PODMAN_OPTIONS inspect --size -l | python -m json.tool | grep SizeRootFs" diff --git a/test/podman_kill.bats b/test/podman_kill.bats index bb55ed31d..f24bd0971 100644 --- a/test/podman_kill.bats +++ b/test/podman_kill.bats @@ -11,61 +11,61 @@ function setup() { } @test "kill a bogus container" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} kill foobar" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} kill foobar echo "$output" [ "$status" -ne 0 ] } @test "kill a running container by id" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 9999" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 9999 [ "$status" -eq 0 ] ctr_id="$output" - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} kill $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} kill $ctr_id [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps [ "$status" -eq 0 ] } @test "kill a running container by id with TERM" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 9999" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 9999 [ "$status" -eq 0 ] ctr_id="$output" - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} kill -s TERM $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} kill -s TERM $ctr_id [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --no-trunc" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --no-trunc [ "$status" -eq 0 ] } @test "kill a running container by name" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name test1 -d ${ALPINE} sleep 9999" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name test1 -d ${ALPINE} sleep 9999 [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} kill -s TERM test1" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} kill -s TERM test1 [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --no-trunc" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --no-trunc [ "$status" -eq 0 ] } @test "kill a running container by id with a bogus signal" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 9999" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 9999 [ "$status" -eq 0 ] ctr_id="$output" - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} kill -s foobar $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} kill -s foobar $ctr_id [ "$status" -eq 125 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --no-trunc" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --no-trunc [ "$status" -eq 0 ] } @test "kill the latest container run" { ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 9999 - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} kill -l" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} kill -l echo "$output" [ "$status" -eq 0 ] } diff --git a/test/podman_load.bats b/test/podman_load.bats index 6fe8638b6..ca93a5522 100644 --- a/test/podman_load.bats +++ b/test/podman_load.bats @@ -10,36 +10,36 @@ function teardown() { cleanup_test } @test "podman load input flag" { - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar $ALPINE + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar $ALPINE echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi $ALPINE + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi $ALPINE echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} load -i alpine.tar + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} load -i alpine.tar echo "$output" [ "$status" -eq 0 ] rm -f alpine.tar } @test "podman load oci-archive image" { - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar --format oci-archive $ALPINE + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar --format oci-archive $ALPINE [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi $ALPINE + run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi $ALPINE [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} load -i alpine.tar + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} load -i alpine.tar echo "$output" [ "$status" -eq 0 ] rm -f alpine.tar } @test "podman load oci-archive image with signature-policy" { - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar --format oci-archive $ALPINE + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar --format oci-archive $ALPINE [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi $ALPINE + run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi $ALPINE [ "$status" -eq 0 ] cp /etc/containers/policy.json /tmp - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} load --signature-policy /tmp/policy.json -i alpine.tar + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} load --signature-policy /tmp/policy.json -i alpine.tar echo "$output" [ "$status" -eq 0 ] rm -f /tmp/policy.json @@ -47,29 +47,29 @@ function teardown() { } @test "podman load using quiet flag" { - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar $ALPINE + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar $ALPINE echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi $ALPINE + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi $ALPINE echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} load -q -i alpine.tar + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} load -q -i alpine.tar echo "$output" [ "$status" -eq 0 ] rm -f alpine.tar } @test "podman load directory" { - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} save --format oci-dir -o alp-dir $ALPINE + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save --format oci-dir -o alp-dir $ALPINE echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi $ALPINE + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi $ALPINE echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} load -i alp-dir + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} load -i alp-dir echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi alp-dir + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi alp-dir echo "$output" [ "$status" -eq 0 ] } diff --git a/test/podman_logs.bats b/test/podman_logs.bats index 342ffac5e..e76bf665a 100644 --- a/test/podman_logs.bats +++ b/test/podman_logs.bats @@ -11,41 +11,41 @@ function setup() { } @test "display logs for container" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB ls echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} logs $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} logs $ctr_id echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rm $ctr_id echo "$output" [ "$status" -eq 0 ] } @test "tail three lines of logs for container" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB ls echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} logs --tail 3 $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} logs --tail 3 $ctr_id echo "$output" lines=$(echo "$output" | wc -l) [ "$status" -eq 0 ] [[ $(wc -l < "$output" ) -le 3 ]] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rm $ctr_id echo "$output" [ "$status" -eq 0 ] } @test "display logs for container since a given time" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB ls echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} logs --since 2017-08-07T10:10:09.056611202-04:00 -l" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} logs --since 2017-08-07T10:10:09.056611202-04:00 -l echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm -l" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rm -l echo "$output" [ "$status" -eq 0 ] } diff --git a/test/podman_mount.bats b/test/podman_mount.bats index bc6be1a19..f3d04fb98 100644 --- a/test/podman_mount.bats +++ b/test/podman_mount.bats @@ -13,26 +13,26 @@ function setup() { } @test "mount" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} create $BB ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create $BB ls echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} mount $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} mount $ctr_id echo "$output" [ "$status" -eq 0 ] run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} mount --notruncate | grep $ctr_id" echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} unmount $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} unmount $ctr_id echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} mount $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} mount $ctr_id echo "$output" [ "$status" -eq 0 ] run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} mount --format=json | python -m json.tool | grep $ctr_id" echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} unmount $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} unmount $ctr_id echo "$output" [ "$status" -eq 0 ] } diff --git a/test/podman_networking.bats b/test/podman_networking.bats index 017f24d8f..b27c16634 100644 --- a/test/podman_networking.bats +++ b/test/podman_networking.bats @@ -11,13 +11,49 @@ function setup() { } @test "test network connection with default bridge" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} run -dt ${ALPINE} wget www.yahoo.com + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -dt ${ALPINE} wget www.yahoo.com + echo "$output" + [ "$status" -eq 0 ] + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} wait --latest echo "$output" [ "$status" -eq 0 ] } @test "test network connection with host" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} run -dt --network host ${ALPINE} wget www.yahoo.com + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -dt --network host ${ALPINE} wget www.yahoo.com + echo "$output" + [ "$status" -eq 0 ] + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} wait --latest + echo "$output" + [ "$status" -eq 0 ] +} + +@test "expose port 222" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -dt --expose 222-223 ${ALPINE} /bin/sh + echo "$output" + [ "$status" -eq 0 ] + run bash -c "iptables -t nat -L" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "iptables -t nat -L | grep 223" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "expose host port 80 to container port 8000" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -dt -p 80:8000 ${ALPINE} /bin/sh + echo "$output" + [ "$status" -eq 0 ] + run bash -c "iptables -t nat -L | grep 8000" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "expose ports in image" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -dt -P docker.io/library/nginx:latest + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect -l | grep ': 80,'" echo "$output" [ "$status" -eq 0 ] } diff --git a/test/podman_pause.bats b/test/podman_pause.bats index b8f0a8746..4e98eb130 100644 --- a/test/podman_pause.bats +++ b/test/podman_pause.bats @@ -11,102 +11,102 @@ function teardown() { } @test "pause a bogus container" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} pause foobar" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} pause foobar echo "$output" [ "$status" -eq 125 ] } @test "unpause a bogus container" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} unpause foobar" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} unpause foobar echo "$output" [ "$status" -eq 125 ] } @test "pause a created container by id" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB sleep 60" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB sleep 60 echo "$output" [ "$status" -eq 0 ] ctr_id=`echo "$output" | tail -n 1` - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} pause $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} pause $ctr_id echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} unpause $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} unpause $ctr_id echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm -f $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rm -f $ctr_id echo "$output" [ "$status" -eq 0 ] } @test "pause a running container by id" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB sleep 60" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB sleep 60 echo "$output" [ "$status" -eq 0 ] ctr_id=`echo "$output" | tail -n 1` - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} pause $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} pause $ctr_id echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} unpause $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} unpause $ctr_id echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm -f $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rm -f $ctr_id echo "$output" [ "$status" -eq 0 ] } @test "unpause a running container" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB sleep 60" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB sleep 60 echo "$output" [ "$status" -eq 0 ] ctr_id=`echo "$output" | tail -n 1` - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} unpause $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} unpause $ctr_id echo "$output" [ "$status" -eq 125 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm -f $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rm -f $ctr_id echo "$output" [ "$status" -eq 0 ] } @test "remove a paused container by id" { skip "Test needs to wait for --force to work for podman rm" - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB sleep 60" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB sleep 60 echo "$output" [ "$status" -eq 0 ] ctr_id=`echo "$output" | tail -n 1` - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} pause $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} pause $ctr_id echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rm $ctr_id echo "$output" [ "$status" -eq 125 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm --force $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rm --force $ctr_id echo "$output" [ "$status" -eq 0 ] } @test "stop a paused container created by id" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB sleep 60" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB sleep 60 echo "$output" [ "$status" -eq 0 ] ctr_id=`echo "$output" | tail -n 1` - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} pause $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} pause $ctr_id echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} stop $ctr_id echo "$output" [ "$status" -eq 125 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} unpause $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} unpause $ctr_id echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --filter id=$ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --filter id=$ctr_id echo "$output" [ "$status" -eq 0 ] # Container should be running after unpause and shouldn't # be removable without the force flag. - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rm $ctr_id echo "$output" [ "$status" -eq 125 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm -f $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rm -f $ctr_id echo "$output" [ "$status" -eq 0 ] } diff --git a/test/podman_ps.bats b/test/podman_ps.bats index b99c84304..8f2232cbf 100644 --- a/test/podman_ps.bats +++ b/test/podman_ps.bats @@ -12,92 +12,92 @@ function teardown() { } @test "podman ps with no containers" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps echo "$output" [ "$status" -eq 0 ] } @test "podman ps default" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps echo "$output" [ "$status" -eq 0 ] } @test "podman ps all flag" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a echo "$output" [ "$status" -eq 0 ] } @test "podman ps size flag" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --size" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --size echo "$output" [ "$status" -eq 0 ] } @test "podman ps quiet flag" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls ctr_id="$output" echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --quiet" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --quiet echo "$output" [ "$status" -eq 0 ] } @test "podman ps latest flag" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --latest" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --latest echo "$output" [ "$status" -eq 0 ] } @test "podman ps last flag" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${BB} ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${BB} ls echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls -s" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls -s echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --last 2" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --last 2 echo "$output" [ "$status" -eq 0 ] } @test "podman ps no-trunc flag" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --no-trunc" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --no-trunc echo "$output" [ "$status" -eq 0 ] } @test "podman ps namespace flag" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --all --namespace" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --all --namespace echo "$output" [ "$status" -eq 0 ] } @test "podman ps namespace flag and format flag = json" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls echo "$output" [ "$status" -eq 0 ] run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --ns --format json | python -m json.tool | grep namespace" @@ -106,7 +106,7 @@ function teardown() { } @test "podman ps without namespace flag and format flag = json" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls echo "$output" [ "$status" -eq 0 ] run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --format json | python -m json.tool | grep namespace" @@ -115,76 +115,76 @@ function teardown() { } @test "podman ps format flag = go template" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --format 'table {{.ID}} {{.Image}} {{.Labels}}'" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --format 'table {{.ID}} {{.Image}} {{.Labels}}' echo "$output" [ "$status" -eq 0 ] } @test "podman ps filter flag - ancestor" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --filter ancestor=${ALPINE}" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --filter ancestor=${ALPINE} echo "$output" [ "$status" -eq 0 ] } @test "podman ps filter flag - id" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --filter id=$ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --filter id=$ctr_id echo "$output" [ "$status" -eq 0 ] } @test "podman ps filter flag - status" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 99" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 99 ctr_id="$output" echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --filter status=running" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --filter status=running echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} stop $ctr_id echo "$output" [ "$status" -eq 0 ] } @test "podman ps short options" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 99" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 99 ctr_id="$output" echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -aq" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -aq echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} stop $ctr_id echo "$output" [ "$status" -eq 0 ] } @test "podman ps with mutually exclusive flags" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 99" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 99 ctr_id="$output" echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -aqs" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -aqs echo "$output" [ "$status" -ne 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --ns -s" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --ns -s echo "$output" [ "$status" -ne 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --ns format {{.ID}}" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --ns format {{.ID}} echo "$output" [ "$status" -ne 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --ns --format json" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --ns --format json echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} stop $ctr_id echo "$output" [ "$status" -eq 0 ] } diff --git a/test/podman_pull.bats b/test/podman_pull.bats index b0de1a8ab..4052d56d5 100644 --- a/test/podman_pull.bats +++ b/test/podman_pull.bats @@ -10,7 +10,7 @@ function teardown() { run ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull debian:6.0.10 echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi debian:6.0.10 + run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi debian:6.0.10 echo "$output" [ "$status" -eq 0 ] } @@ -19,7 +19,7 @@ function teardown() { run ${PODMAN_BINARY} $PODMAN_OPTIONS pull debian echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi debian + run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi debian echo "$output" [ "$status" -eq 0 ] } @@ -28,7 +28,7 @@ function teardown() { run ${PODMAN_BINARY} $PODMAN_OPTIONS pull registry.fedoraproject.org/fedora:rawhide echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi registry.fedoraproject.org/fedora:rawhide + run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi registry.fedoraproject.org/fedora:rawhide echo "$output" [ "$status" -eq 0 ] } @@ -37,7 +37,7 @@ function teardown() { run ${PODMAN_BINARY} $PODMAN_OPTIONS pull registry.fedoraproject.org/fedora echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi registry.fedoraproject.org/fedora + run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi registry.fedoraproject.org/fedora echo "$output" [ "$status" -eq 0 ] } @@ -46,7 +46,7 @@ function teardown() { run ${PODMAN_BINARY} $PODMAN_OPTIONS pull alpine@sha256:1072e499f3f655a032e88542330cf75b02e7bdf673278f701d7ba61629ee3ebe echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi alpine:latest + run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi alpine:latest echo "$output" [ "$status" -eq 0 ] } @@ -61,7 +61,7 @@ function teardown() { run ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull debian echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi docker.io/debian:latest + run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi docker.io/debian:latest echo "$output" [ "$status" -eq 0 ] } @@ -70,7 +70,7 @@ function teardown() { run ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull debian:6.0.10 echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi docker.io/debian:6.0.10 + run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi docker.io/debian:6.0.10 echo "$output" [ "$status" -eq 0 ] } @@ -79,57 +79,57 @@ function teardown() { run ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull alpine echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alp.tar alpine + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alp.tar alpine echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi alpine + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi alpine echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull docker-archive:alp.tar + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull docker-archive:alp.tar echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi alpine + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi alpine echo "$output" [ "$status" -eq 0 ] rm -f alp.tar } @test "podman pull from oci-archive" { - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull alpine + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull alpine echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} save --format oci-archive -o oci-alp.tar alpine + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save --format oci-archive -o oci-alp.tar alpine echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi alpine + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi alpine echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull oci-archive:oci-alp.tar + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull oci-archive:oci-alp.tar echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi alpine + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi alpine echo "$output" [ "$status" -eq 0 ] rm -f oci-alp.tar } @test "podman pull from local directory" { - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull alpine + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull alpine echo "$output" [ "$status" -eq 0 ] run mkdir test_pull_dir echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} push alpine dir:test_pull_dir + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} push alpine dir:test_pull_dir echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi alpine + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi alpine echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull dir:test_pull_dir + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull dir:test_pull_dir echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi test_pull_dir + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi test_pull_dir echo "$output" [ "$status" -eq 0 ] rm -rf test_pull_dir diff --git a/test/podman_push.bats b/test/podman_push.bats index 82798b3fc..8308f4e83 100644 --- a/test/podman_push.bats +++ b/test/podman_push.bats @@ -36,7 +36,7 @@ function setup() { echo "$output" [ "$status" -eq 0 ] rm -rf /tmp/busybox - run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi $ALPINE + run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi $ALPINE echo "$output" [ "$status" -eq 0 ] } @@ -47,7 +47,7 @@ function setup() { echo "--->" [ "$status" -eq 0 ] rm /tmp/busybox-archive - run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi $ALPINE + run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi $ALPINE echo "$output" [ "$status" -eq 0 ] } @@ -57,18 +57,18 @@ function setup() { echo "$output" [ "$status" -eq 0 ] rm -f /tmp/oci-busybox.tar - run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi $ALPINE + run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi $ALPINE echo "$output" [ "$status" -eq 0 ] } @test "podman push without signatures" { mkdir /tmp/busybox - run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS push --remove-signatures $ALPINE dir:/tmp/busybox + run ${PODMAN_BINARY} $PODMAN_OPTIONS push --remove-signatures $ALPINE dir:/tmp/busybox echo "$output" [ "$status" -eq 0 ] rm -rf /tmp/busybox - run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi $ALPINE + run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi $ALPINE echo "$output" [ "$status" -eq 0 ] } @@ -86,13 +86,13 @@ function setup() { } @test "push with manifest type conversion" { - run bash -c "${PODMAN_BINARY} $PODMAN_OPTIONS push --format oci "${BB}" dir:my-dir" + run ${PODMAN_BINARY} $PODMAN_OPTIONS push --format oci "${BB}" dir:my-dir echo "$output" [ "$status" -eq 0 ] - run bash -c "grep "application/vnd.oci.image.config.v1+json" my-dir/manifest.json" + run grep "application/vnd.oci.image.config.v1+json" my-dir/manifest.json echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} $PODMAN_OPTIONS push --compress --format v2s2 "${BB}" dir:my-dir" + run ${PODMAN_BINARY} $PODMAN_OPTIONS push --compress --format v2s2 "${BB}" dir:my-dir echo "$output" [ "$status" -eq 0 ] run bash -c "grep "application/vnd.docker.distribution.manifest.v2+json" my-dir/manifest.json" diff --git a/test/podman_rm.bats b/test/podman_rm.bats index f6430711f..8382bb3fe 100644 --- a/test/podman_rm.bats +++ b/test/podman_rm.bats @@ -15,7 +15,7 @@ function teardown() { echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rm "$ctr_id" + run ${PODMAN_BINARY} $PODMAN_OPTIONS rm "$ctr_id" echo "$output" [ "$status" -eq 0 ] } @@ -35,7 +35,7 @@ function teardown() { echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rm -f "$ctr_id" + run ${PODMAN_BINARY} $PODMAN_OPTIONS rm -f "$ctr_id" echo "$output" [ "$status" -eq 0 ] } @@ -45,7 +45,7 @@ function teardown() { echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rm -f "$ctr_id" + run ${PODMAN_BINARY} $PODMAN_OPTIONS rm -f "$ctr_id" echo "$output" [ "$status" -eq 0 ] } diff --git a/test/podman_run.bats b/test/podman_run.bats index 7066000d0..9fa048439 100644 --- a/test/podman_run.bats +++ b/test/podman_run.bats @@ -11,19 +11,19 @@ function setup() { } @test "run a container based on local image" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run $BB ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run $BB ls echo "$output" [ "$status" -eq 0 ] } @test "run a container based on local image with short options" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -dt $BB ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -dt $BB ls echo "$output" [ "$status" -eq 0 ] } @test "run a container based on a remote image" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run ${BB_GLIBC} ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run ${BB_GLIBC} ls echo "$output" [ "$status" -eq 0 ] } @@ -33,11 +33,11 @@ function setup() { skip "SELinux not enabled" fi - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run ${ALPINE} cat /proc/self/attr/current" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run ${ALPINE} cat /proc/self/attr/current echo "$output" firstLabel=$output - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run ${ALPINE} cat /proc/self/attr/current" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run ${ALPINE} cat /proc/self/attr/current echo "$output" [ "$output" != "${firstLabel}" ] } @@ -52,19 +52,19 @@ function setup() { } @test "run capabilities test" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --cap-add all ${ALPINE} cat /proc/self/status" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --cap-add all ${ALPINE} cat /proc/self/status echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --cap-add sys_admin ${ALPINE} cat /proc/self/status" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --cap-add sys_admin ${ALPINE} cat /proc/self/status echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --cap-drop all ${ALPINE} cat /proc/self/status" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --cap-drop all ${ALPINE} cat /proc/self/status echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --cap-drop setuid ${ALPINE} cat /proc/self/status" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --cap-drop setuid ${ALPINE} cat /proc/self/status echo "$output" [ "$status" -eq 0 ] @@ -86,7 +86,7 @@ function setup() { [ "$status" -eq 0 ] [ "$output" = "BAR" ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --env FOO ${ALPINE} printenv" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --env FOO ${ALPINE} printenv echo "$output" [ "$status" -ne 0 ] @@ -101,7 +101,7 @@ function setup() { IMAGE="docker.io/library/fedora:latest" @test "run limits test" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --ulimit rtprio=99 --cap-add=sys_nice ${IMAGE} cat /proc/self/sched" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --ulimit rtprio=99 --cap-add=sys_nice ${IMAGE} cat /proc/self/sched echo $output [ "$status" -eq 0 ] @@ -110,7 +110,12 @@ IMAGE="docker.io/library/fedora:latest" [ "$status" -eq 0 ] [ "$output" = 2048 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --oom-kill-disable=true ${IMAGE} echo memory-hog" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --ulimit nofile=1024:1028 ${IMAGE} ulimit -n | tr -d '\r'" + echo $output + [ "$status" -eq 0 ] + [ "$output" = 1024 ] + + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --oom-kill-disable=true ${IMAGE} echo memory-hog echo $output [ "$status" -eq 0 ] @@ -134,10 +139,24 @@ IMAGE="docker.io/library/fedora:latest" } @test "podman run with cidfile" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --cidfile /tmp/cidfile $BB ls" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --cidfile /tmp/cidfile $BB ls echo "$output" [ "$status" -eq 0 ] run rm /tmp/cidfile echo "$output" [ "$status" -eq 0 ] } + +@test "podman run sysctl test" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --sysctl net.core.somaxconn=65535 ${ALPINE} sysctl net.core.somaxconn | tr -d '\r'" + echo "$output" + [ "$status" -eq 0 ] + [ "$output" = "net.core.somaxconn = 65535" ] +} + +@test "podman run blkio-weight test" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --blkio-weight=15 ${ALPINE} cat /sys/fs/cgroup/blkio/blkio.weight | tr -d '\r'" + echo "$output" + [ "$status" -eq 0 ] + [ "$output" = 15 ] +} diff --git a/test/podman_run_cpu.bats b/test/podman_run_cpu.bats new file mode 100644 index 000000000..ebd411b41 --- /dev/null +++ b/test/podman_run_cpu.bats @@ -0,0 +1,71 @@ +#!/usr/bin/env bats + +load helpers + +function teardown() { + cleanup_test +} + +function setup() { + copy_images +} + +@test "run cpu-period test" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --cpu-period=5000 ${ALPINE} cat /sys/fs/cgroup/cpu/cpu.cfs_period_us | tr -d '\r'" + echo $output + [ "$status" -eq 0 ] + [ "$output" = 5000 ] +} + +@test "run cpu-quota test" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --cpu-quota=5000 ${ALPINE} cat /sys/fs/cgroup/cpu/cpu.cfs_quota_us | tr -d '\r'" + echo "$output" + [ "$status" -eq 0 ] + [ "$output" = 5000 ] +} + +@test "run cpus test" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --cpus=0.5 ${ALPINE} cat /sys/fs/cgroup/cpu/cpu.cfs_period_us | tr -d '\r'" + echo "$output" + [ "$status" -eq 0 ] + [ "$output" = 100000 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --cpus=0.5 ${ALPINE} cat /sys/fs/cgroup/cpu/cpu.cfs_quota_us | tr -d '\r'" + echo "$output" + [ "$status" -eq 0 ] + [ "$output" = 50000 ] +} + +@test "run cpu-shares test" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --cpu-shares=2 ${ALPINE} cat /sys/fs/cgroup/cpu/cpu.shares | tr -d '\r'" + echo "$output" + [ "$status" -eq 0 ] + [ "$output" = 2 ] +} + +@test "run cpuset-cpus test" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --cpuset-cpus=0 ${ALPINE} cat /sys/fs/cgroup/cpuset/cpuset.cpus | tr -d '\r'" + echo "$output" + [ "$status" -eq 0 ] + [ "$output" = 0 ] +} + +@test "run cpuset-mems test" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --cpuset-mems=0 ${ALPINE} cat /sys/fs/cgroup/cpuset/cpuset.mems | tr -d '\r'" + echo "$output" + [ "$status" -eq 0 ] + [ "$output" = 0 ] +} + +@test "run failure if cpus and cpu-period set together test" { + # skip, error code incorrect with bash -c and will fail centos test without bash -c + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --cpu-period=5000 --cpus=0.5 ${ALPINE} /bin/bash + echo "$output" + [ "$status" -ne 0 ] +} + +@test "run failure if cpus and cpu-quota set together test" { + # skip, error code incorrect with bash -c and will fail centos test without bash -c + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --cpu-quota=5000 --cpus=0.5 ${ALPINE} /bin/bash + echo "$output" + [ "$status" -ne 0 ] +} diff --git a/test/podman_run_dns.bats b/test/podman_run_dns.bats new file mode 100644 index 000000000..d37737093 --- /dev/null +++ b/test/podman_run_dns.bats @@ -0,0 +1,56 @@ +#!/usr/bin/env bats + +load helpers + +function teardown() { + cleanup_test +} + +function setup() { + copy_images +} + +@test "test addition of a search domain" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --dns-search=foobar.com ${ALPINE} cat /etc/resolv.conf | grep foo" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "test addition of a bad dns server" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create --dns="foo" ${ALPINE} ls + echo "$output" + [ "$status" -ne 0 ] +} + +@test "test addition of a dns server" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --dns='1.2.3.4' ${ALPINE} cat /etc/resolv.conf | grep '1.2.3.4'" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "test addition of a dns option" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --dns-opt='debug' ${ALPINE} cat /etc/resolv.conf | grep 'options debug'" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "test addition of a bad add-host" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create --add-host="foo:1.2" ${ALPINE} ls + echo "$output" + [ "$status" -ne 0 ] +} + +@test "test addition of add-host" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --add-host='foobar:1.1.1.1' ${ALPINE} cat /etc/hosts | grep 'foobar'" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "test addition of hostname" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --hostname='foobar' ${ALPINE} cat /etc/hostname | grep foobar" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --hostname='foobar' ${ALPINE} hostname | grep foobar" + echo "$output" + [ "$status" -eq 0 ] +} diff --git a/test/podman_run_memory.bats b/test/podman_run_memory.bats new file mode 100644 index 000000000..2eaebe104 --- /dev/null +++ b/test/podman_run_memory.bats @@ -0,0 +1,39 @@ +#!/usr/bin/env bats + +load helpers + +function teardown() { + cleanup_test +} + +function setup() { + copy_images +} + +@test "run memory test" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --memory=40m ${ALPINE} cat /sys/fs/cgroup/memory/memory.limit_in_bytes | tr -d '\r'" + echo $output + [ "$status" -eq 0 ] + [ "$output" = 41943040 ] +} + +@test "run memory-reservation test" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --memory-reservation=40m ${ALPINE} cat /sys/fs/cgroup/memory/memory.soft_limit_in_bytes | tr -d '\r'" + echo "$output" + [ "$status" -eq 0 ] + [ "$output" = 41943040 ] +} + +@test "run memory-swappiness test" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --memory-swappiness=15 ${ALPINE} cat /sys/fs/cgroup/memory/memory.swappiness | tr -d '\r'" + echo "$output" + [ "$status" -eq 0 ] + [ "$output" = 15 ] +} + +@test "run kernel-memory test" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --rm --kernel-memory=40m ${ALPINE} cat /sys/fs/cgroup/memory/memory.kmem.limit_in_bytes | tr -d '\r'" + echo "$output" + [ "$status" -eq 0 ] + [ "$output" = 41943040 ] +} diff --git a/test/podman_save.bats b/test/podman_save.bats index 27e627b8f..9c6fa8b86 100644 --- a/test/podman_save.bats +++ b/test/podman_save.bats @@ -11,14 +11,14 @@ function setup() { } @test "podman save output flag" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar $ALPINE" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar $ALPINE echo "$output" [ "$status" -eq 0 ] rm -f alpine.tar } @test "podman save oci flag" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar --format oci-archive $ALPINE" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar --format oci-archive $ALPINE echo "$output" [ "$status" -eq 0 ] rm -f alpine.tar @@ -31,27 +31,27 @@ function setup() { } @test "podman save quiet flag" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} save -q -o alpine.tar $ALPINE" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -q -o alpine.tar $ALPINE echo "$output" [ "$status" -eq 0 ] rm -f alpine.tar } @test "podman save non-existent image" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar FOOBAR" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar FOOBAR echo "$output" [ "$status" -ne 0 ] } @test "podman save to directory wit oci format" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} save --format oci-dir -o alp-dir $ALPINE" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save --format oci-dir -o alp-dir $ALPINE echo "$output" [ "$status" -eq 0 ] rm -rf alp-dir } @test "podman save to directory wit v2s2 (docker) format" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} save --format docker-dir -o alp-dir $ALPINE" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} save --format docker-dir -o alp-dir $ALPINE echo "$output" [ "$status" -eq 0 ] rm -rf alp-dir diff --git a/test/podman_stop.bats b/test/podman_stop.bats index 839301435..7675ee9a9 100644 --- a/test/podman_stop.bats +++ b/test/podman_stop.bats @@ -11,46 +11,46 @@ function setup() { } @test "stop a bogus container" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop foobar" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} stop foobar echo "$output" [ "$status" -eq 125 ] } @test "stop a running container by id" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 9999" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 9999 [ "$status" -eq 0 ] ctr_id="$output" - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} stop $ctr_id [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps [ "$status" -eq 0 ] } @test "stop a running container by name" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name test1 -d ${ALPINE} sleep 9999" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name test1 -d ${ALPINE} sleep 9999 [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop test1" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} stop test1 [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} ps [ "$status" -eq 0 ] } @test "stop all containers" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name test1 -d ${ALPINE} sleep 9999" - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name test2 -d ${ALPINE} sleep 9999" - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name test3 -d ${ALPINE} sleep 9999" - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop -a -t 1" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name test1 -d ${ALPINE} sleep 9999 + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name test2 -d ${ALPINE} sleep 9999 + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name test3 -d ${ALPINE} sleep 9999 + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} stop -a -t 1 echo "$output" [ "$status" -eq 0 ] } @test "stop a container with latest" { ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 9999 - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop -t 1 -l" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} stop -t 1 -l echo "$output" [ "$status" -eq 0 ] } diff --git a/test/podman_tag.bats b/test/podman_tag.bats index 024cf6295..749c3ae2c 100644 --- a/test/podman_tag.bats +++ b/test/podman_tag.bats @@ -11,33 +11,33 @@ function setup() { } @test "podman tag with shortname:latest" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} tag ${ALPINE} foobar:latest" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} tag ${ALPINE} foobar:latest [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect foobar:latest" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect foobar:latest echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi --force foobar:latest" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi --force foobar:latest [ "$status" -eq 0 ] } @test "podman tag with shortname" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} tag ${ALPINE} foobar" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} tag ${ALPINE} foobar echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect foobar:latest" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect foobar:latest echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi --force foobar:latest" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi --force foobar:latest [ "$status" -eq 0 ] } @test "podman tag with shortname:tag" { - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} tag ${ALPINE} foobar:v" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} tag ${ALPINE} foobar:v echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect foobar:v" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect foobar:v echo "$output" [ "$status" -eq 0 ] - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi --force foobar:v" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi --force foobar:v [ "$status" -eq 0 ] } diff --git a/test/podman_top.bats b/test/podman_top.bats index a8b92cd44..cfa037aa6 100644 --- a/test/podman_top.bats +++ b/test/podman_top.bats @@ -26,7 +26,7 @@ function setup() { run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create -d ${ALPINE} sleep 60 [ "$status" -eq 0 ] ctr_id="$output" - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} top $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} top $ctr_id echo "$output" [ "$status" -eq 125 ] } @@ -36,7 +36,7 @@ function setup() { [ "$status" -eq 0 ] ctr_id="$output" echo $ctr_id - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} top $ctr_id" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} top $ctr_id echo "$output" [ "$status" -eq 0 ] } @@ -45,7 +45,7 @@ function setup() { run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 60 [ "$status" -eq 0 ] ctr_id="$output" - run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} top $ctr_id -o fuser,f,comm,label" + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} top $ctr_id -o fuser,f,comm,label echo "$output" [ "$status" -eq 0 ] } diff --git a/test/podman_version.bats b/test/podman_version.bats index 0f959277b..a44da5943 100644 --- a/test/podman_version.bats +++ b/test/podman_version.bats @@ -7,7 +7,7 @@ function teardown() { } @test "podman version test" { - run bash -c "${PODMAN_BINARY} version" + run ${PODMAN_BINARY} version echo "$output" [ "$status" -eq 0 ] } |