summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-10-18 15:38:22 +0200
committerGitHub <noreply@github.com>2019-10-18 15:38:22 +0200
commit83644e24e56e80712e4ba340917f3520fcb94ccd (patch)
treedc7568cc2f6256a937cea6fe03708608906761c3
parentb6fdfa041a3e0f0a754c1f3a6edd8bc0be6f6ed8 (diff)
parent774a36d1771b083825fcf4c89385e90499537cb1 (diff)
downloadpodman-83644e24e56e80712e4ba340917f3520fcb94ccd.tar.gz
podman-83644e24e56e80712e4ba340917f3520fcb94ccd.tar.bz2
podman-83644e24e56e80712e4ba340917f3520fcb94ccd.zip
Merge pull request #4282 from chuanchang/bz1731117
System tests: make sure exec pid hash w/o leaking
-rw-r--r--test/system/075-exec.bats20
-rw-r--r--test/system/helpers.bash14
2 files changed, 34 insertions, 0 deletions
diff --git a/test/system/075-exec.bats b/test/system/075-exec.bats
index 11cb98269..472fdd1ab 100644
--- a/test/system/075-exec.bats
+++ b/test/system/075-exec.bats
@@ -29,4 +29,24 @@ load helpers
run_podman rm $cid
}
+@test "podman exec - leak check" {
+ skip_if_remote
+
+ # Start a container in the background then run exec command
+ # three times and make sure no any exec pid hash file leak
+ run_podman run -td $IMAGE /bin/sh
+ cid="$output"
+
+ is "$(check_exec_pid)" "" "exec pid hash file indeed doesn't exist"
+
+ for i in {1..3}; do
+ run_podman exec $cid /bin/true
+ done
+
+ is "$(check_exec_pid)" "" "there isn't any exec pid hash file leak"
+
+ run_podman stop --time 1 $cid
+ run_podman rm -f $cid
+}
+
# vim: filetype=sh
diff --git a/test/system/helpers.bash b/test/system/helpers.bash
index 3d607f4bd..8c061d2c9 100644
--- a/test/system/helpers.bash
+++ b/test/system/helpers.bash
@@ -373,5 +373,19 @@ function random_string() {
head /dev/urandom | tr -dc a-zA-Z0-9 | head -c$length
}
+
+#########################
+# find_exec_pid_files # Returns nothing or exec_pid hash files
+#########################
+#
+# Return exec_pid hash files if exists, otherwise, return nothing
+#
+function find_exec_pid_files() {
+ run_podman info --format '{{.store.RunRoot}}'
+ local storage_path="$output"
+ if [ -d $storage_path ]; then
+ find $storage_path -type f -iname 'exec_pid_*'
+ fi
+}
# END miscellaneous tools
###############################################################################