summaryrefslogtreecommitdiff
path: root/test/system/075-exec.bats
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2019-03-07 15:15:50 -0700
committerEd Santiago <santiago@redhat.com>2019-03-18 15:21:52 -0600
commit58d2e589fb4dbcc23cfc5ddd3f886a32a0ab759e (patch)
tree647f839b8dda979e8526f6aa335d4bc2c52ff468 /test/system/075-exec.bats
parent07e10d9dd6c0c0828637f770234266daa182fc95 (diff)
downloadpodman-58d2e589fb4dbcc23cfc5ddd3f886a32a0ab759e.tar.gz
podman-58d2e589fb4dbcc23cfc5ddd3f886a32a0ab759e.tar.bz2
podman-58d2e589fb4dbcc23cfc5ddd3f886a32a0ab759e.zip
BATS: new tests, and improvements to existing ones
New: - podman exec - podman load (requires #2674) - CLI parsing (regression test for #2574) Improved: - help: test "podman NoSuchCommand", and subcommands - help: test "podman cmd" without required args - pod: start with --infra=false; this allows running rootless - log: also run 'logs' after container is run - log: test -f with two containers Also, use helpful descriptions for skip_if_rootless Tested on f29, root and rootless. As soon as podman-remote supports rm, I'll start testing that too. Signed-off-by: Ed Santiago <santiago@redhat.com>
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