aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-01-04 08:53:46 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-01-04 21:05:10 +0000
commitb231e3412e7d37d9680229e3782e28161792c7f8 (patch)
treeda0d214d45bbb13b3254dfe450b73ddc24e44351 /test
parent137e5c8ffd5e1d7abe47398d909c9611f19bfcbb (diff)
downloadpodman-b231e3412e7d37d9680229e3782e28161792c7f8.tar.gz
podman-b231e3412e7d37d9680229e3782e28161792c7f8.tar.bz2
podman-b231e3412e7d37d9680229e3782e28161792c7f8.zip
Fix handling of exit codes
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #183 Approved by: TomSweeneyRedHat
Diffstat (limited to 'test')
-rw-r--r--test/podman_attach.bats6
-rw-r--r--test/podman_exec.bats4
-rw-r--r--test/podman_kill.bats2
-rw-r--r--test/podman_pause.bats10
-rw-r--r--test/podman_rmi.bats2
-rw-r--r--test/podman_run_exit.bats46
-rw-r--r--test/podman_start.bats4
-rw-r--r--test/podman_stats.bats2
-rw-r--r--test/podman_stop.bats2
-rw-r--r--test/podman_top.bats6
-rw-r--r--test/podman_wait.bats2
11 files changed, 66 insertions, 20 deletions
diff --git a/test/podman_attach.bats b/test/podman_attach.bats
index 9baaf339c..8676b2e43 100644
--- a/test/podman_attach.bats
+++ b/test/podman_attach.bats
@@ -13,14 +13,14 @@ function setup() {
@test "attach to a bogus container" {
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} attach foobar"
echo "$output"
- [ "$status" -eq 1 ]
+ [ "$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"
echo "$output"
- [ "$status" -eq 1 ]
+ [ "$status" -eq 125 ]
}
@test "attach to multiple containers" {
@@ -28,5 +28,5 @@ function setup() {
${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name foobar2 -d -i ${ALPINE} /bin/sh
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} attach foobar1 foobar2"
echo "$output"
- [ "$status" -eq 1 ]
+ [ "$status" -eq 125 ]
}
diff --git a/test/podman_exec.bats b/test/podman_exec.bats
index 76114aa0a..2d6a42704 100644
--- a/test/podman_exec.bats
+++ b/test/podman_exec.bats
@@ -13,13 +13,13 @@ function setup() {
@test "exec into a bogus container" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} exec foobar ls
echo "$output"
- [ "$status" -eq 1 ]
+ [ "$status" -eq 125 ]
}
@test "exec without command should fail" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} exec foobar
echo "$output"
- [ "$status" -eq 1 ]
+ [ "$status" -eq 125 ]
}
@test "exec simple command" {
diff --git a/test/podman_kill.bats b/test/podman_kill.bats
index 449603905..1ccf373bb 100644
--- a/test/podman_kill.bats
+++ b/test/podman_kill.bats
@@ -58,7 +58,7 @@ function setup() {
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps"
[ "$status" -eq 0 ]
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} kill -s foobar $ctr_id"
- [ "$status" -eq 1 ]
+ [ "$status" -eq 125 ]
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --no-trunc"
[ "$status" -eq 0 ]
}
diff --git a/test/podman_pause.bats b/test/podman_pause.bats
index 52add0397..49db0c2aa 100644
--- a/test/podman_pause.bats
+++ b/test/podman_pause.bats
@@ -13,13 +13,13 @@ function teardown() {
@test "pause a bogus container" {
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} pause foobar"
echo "$output"
- [ "$status" -eq 1 ]
+ [ "$status" -eq 125 ]
}
@test "unpause a bogus container" {
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} unpause foobar"
echo "$output"
- [ "$status" -eq 1 ]
+ [ "$status" -eq 125 ]
}
@test "pause a created container by id" {
@@ -61,7 +61,7 @@ function teardown() {
ctr_id=`echo "$output" | tail -n 1`
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} unpause $ctr_id"
echo "$output"
- [ "$status" -eq 1 ]
+ [ "$status" -eq 125 ]
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm -f $ctr_id"
echo "$output"
[ "$status" -eq 0 ]
@@ -78,7 +78,7 @@ function teardown() {
[ "$status" -eq 0 ]
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm $ctr_id"
echo "$output"
- [ "$status" -eq 1 ]
+ [ "$status" -eq 125 ]
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm --force $ctr_id"
echo "$output"
[ "$status" -eq 0 ]
@@ -94,7 +94,7 @@ function teardown() {
[ "$status" -eq 0 ]
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop $ctr_id"
echo "$output"
- [ "$status" -eq 1 ]
+ [ "$status" -eq 125 ]
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} unpause $ctr_id"
echo "$output"
[ "$status" -eq 0 ]
diff --git a/test/podman_rmi.bats b/test/podman_rmi.bats
index dabf2f0e8..e800a0388 100644
--- a/test/podman_rmi.bats
+++ b/test/podman_rmi.bats
@@ -19,7 +19,7 @@ function pullImages() {
@test "podman rmi bogus image" {
run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi debian:6.0.10
echo "$output"
- [ "$status" -eq 1 ]
+ [ "$status" -eq 125 ]
}
@test "podman rmi image with fq name" {
diff --git a/test/podman_run_exit.bats b/test/podman_run_exit.bats
new file mode 100644
index 000000000..02ccb56ec
--- /dev/null
+++ b/test/podman_run_exit.bats
@@ -0,0 +1,46 @@
+#!/usr/bin/env bats
+
+load helpers
+
+function teardown() {
+ cleanup_test
+}
+
+function setup() {
+ copy_images
+}
+
+@test "run exit125 test" {
+ run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --foobar ${ALPINE} ls $tmp
+ echo $output
+ echo $status != 125
+ [ $status -eq 125 ]
+}
+
+@test "run exit126 test" {
+ run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run ${ALPINE} foobar
+ echo $output
+ echo $status != 126
+ [ "$status" -eq 126 ]
+}
+
+@test "run exit127 test" {
+ run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run ${ALPINE} /etc
+ echo $output
+ echo $status != 127
+ [ "$status" -eq 127 ]
+}
+
+@test "run exit0 test" {
+ run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run ${ALPINE} ps
+ echo $output
+ echo $status != 0
+ [ "$status" -eq 0 ]
+}
+
+@test "run exit50 test" {
+ run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run ${ALPINE} sh -c "exit 50"
+ echo $output
+ echo $status != 50
+ [ "$status" -eq 50 ]
+}
diff --git a/test/podman_start.bats b/test/podman_start.bats
index 50cbf43dc..71afc83ff 100644
--- a/test/podman_start.bats
+++ b/test/podman_start.bats
@@ -13,7 +13,7 @@ function teardown() {
@test "start bogus container" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} start 1234
echo "$output"
- [ "$status" -eq 1 ]
+ [ "$status" -eq 125 ]
}
@test "start single container by id" {
@@ -46,5 +46,5 @@ function teardown() {
${PODMAN_BINARY} ${PODMAN_OPTIONS} create --name foobar2 -d ${ALPINE} ls
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} start -a foobar1 foobar2
echo "$output"
- [ "$status" -eq 1 ]
+ [ "$status" -eq 125 ]
}
diff --git a/test/podman_stats.bats b/test/podman_stats.bats
index 91ef62f6b..7bdd0ee63 100644
--- a/test/podman_stats.bats
+++ b/test/podman_stats.bats
@@ -19,7 +19,7 @@ function setup() {
@test "stats with bogus container id" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} stats --no-stream 123
echo "$output"
- [ "$status" -eq 1 ]
+ [ "$status" -eq 125 ]
}
@test "stats on a running container" {
diff --git a/test/podman_stop.bats b/test/podman_stop.bats
index b505d8827..498d71838 100644
--- a/test/podman_stop.bats
+++ b/test/podman_stop.bats
@@ -13,7 +13,7 @@ function setup() {
@test "stop a bogus container" {
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop foobar"
echo "$output"
- [ "$status" -eq 1 ]
+ [ "$status" -eq 125 ]
}
@test "stop a running container by id" {
diff --git a/test/podman_top.bats b/test/podman_top.bats
index e592a0e22..a8b92cd44 100644
--- a/test/podman_top.bats
+++ b/test/podman_top.bats
@@ -13,13 +13,13 @@ function setup() {
@test "top without container name or id" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} top
echo "$output"
- [ "$status" -eq 1 ]
+ [ "$status" -eq 125 ]
}
@test "top a bogus container" {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} top foobar
echo "$output"
- [ "$status" -eq 1 ]
+ [ "$status" -eq 125 ]
}
@test "top non-running container by id with defaults" {
@@ -28,7 +28,7 @@ function setup() {
ctr_id="$output"
run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} top $ctr_id"
echo "$output"
- [ "$status" -eq 1 ]
+ [ "$status" -eq 125 ]
}
@test "top running container by id with defaults" {
diff --git a/test/podman_wait.bats b/test/podman_wait.bats
index 2ebf1d58d..3109ce91e 100644
--- a/test/podman_wait.bats
+++ b/test/podman_wait.bats
@@ -14,7 +14,7 @@ function teardown() {
run ${PODMAN_BINARY} ${PODMAN_OPTIONS} wait 12343
echo $output
echo $status
- [ "$status" -eq 1 ]
+ [ "$status" -eq 125 ]
}
@test "wait on a stopped container" {