summaryrefslogtreecommitdiff
path: root/test/system/075-exec.bats
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-03-19 09:12:27 -0700
committerGitHub <noreply@github.com>2019-03-19 09:12:27 -0700
commit537c382f5bd098bc89a457554db9bd0b08eab3c2 (patch)
tree649331a8c1b88393f07fe061390e5ca8a51b2007 /test/system/075-exec.bats
parenta1299f506d9b93824fae737f0f68a19adaf2bde1 (diff)
parent58d2e589fb4dbcc23cfc5ddd3f886a32a0ab759e (diff)
downloadpodman-537c382f5bd098bc89a457554db9bd0b08eab3c2.tar.gz
podman-537c382f5bd098bc89a457554db9bd0b08eab3c2.tar.bz2
podman-537c382f5bd098bc89a457554db9bd0b08eab3c2.zip
Merge pull request #2703 from edsantiago/bats
BATS: new tests, and improvements to existing ones
Diffstat (limited to 'test/system/075-exec.bats')
-rw-r--r--test/system/075-exec.bats30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/system/075-exec.bats b/test/system/075-exec.bats
new file mode 100644
index 000000000..a12d28b32
--- /dev/null
+++ b/test/system/075-exec.bats
@@ -0,0 +1,30 @@
+#!/usr/bin/env bats -*- bats -*-
+#
+# Tests for podman exec
+#
+
+load helpers
+
+@test "podman exec - basic test" {
+ rand_filename=$(random_string 20)
+ rand_content=$(random_string 50)
+
+ # Start a container. Write random content to random file, then stay
+ # alive as long as file exists. (This test will remove that file soon.)
+ run_podman run -d $IMAGE sh -c \
+ "echo $rand_content >/$rand_filename;echo READY;while [ -f /$rand_filename ]; do sleep 1; done"
+ cid="$output"
+ wait_for_ready $cid
+
+ run_podman exec $cid sh -c "cat /$rand_filename"
+ is "$output" "$rand_content" "Can exec and see file in running container"
+
+ run_podman exec $cid rm -f /$rand_filename
+
+ run_podman wait $cid
+ is "$output" "0" "output from podman wait (container exit code)"
+
+ run_podman rm $cid
+}
+
+# vim: filetype=sh