summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-09-07 15:51:41 +0200
committerGitHub <noreply@github.com>2021-09-07 15:51:41 +0200
commit8a55363b80a012b6c6e774957ac477d0fd540a5e (patch)
tree97baa90a5f4364ff6731921649441407625fecd7 /test
parentc20227bd16cae98247955b14f6dfea33a26c6a0b (diff)
parentd1573b95e3427efae21da784e3112c5fb3d463fb (diff)
downloadpodman-8a55363b80a012b6c6e774957ac477d0fd540a5e.tar.gz
podman-8a55363b80a012b6c6e774957ac477d0fd540a5e.tar.bz2
podman-8a55363b80a012b6c6e774957ac477d0fd540a5e.zip
Merge pull request #11459 from vrothberg/fix-11438
generate systemd: handle --restart
Diffstat (limited to 'test')
-rw-r--r--test/system/250-systemd.bats23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/system/250-systemd.bats b/test/system/250-systemd.bats
index 08fad5e7c..4578d9e60 100644
--- a/test/system/250-systemd.bats
+++ b/test/system/250-systemd.bats
@@ -136,6 +136,29 @@ function service_cleanup() {
service_cleanup
}
+# Regression test for #11438
+@test "podman generate systemd - restart policy" {
+ cname=$(random_string)
+ run_podman create --restart=always --name $cname $IMAGE
+ run_podman generate systemd --new $cname
+ is "$output" ".*Restart=always.*" "Use container's restart policy if set"
+ run_podman generate systemd --new --restart-policy=on-failure $cname
+ is "$output" ".*Restart=on-failure.*" "Override container's restart policy"
+
+ cname2=$(random_string)
+ run_podman create --restart=unless-stopped --name $cname2 $IMAGE
+ run_podman generate systemd --new $cname2
+ is "$output" ".*Restart=always.*" "unless-stopped translated to always"
+
+ cname3=$(random_string)
+ run_podman create --restart=on-failure:42 --name $cname3 $IMAGE
+ run_podman generate systemd --new $cname3
+ is "$output" ".*Restart=on-failure.*" "on-failure:xx is parsed correclty"
+ is "$output" ".*StartLimitBurst=42.*" "on-failure:xx is parsed correctly"
+
+ run_podman rm -f $cname $cname2 $cname3
+}
+
function set_listen_env() {
export LISTEN_PID="100" LISTEN_FDS="1" LISTEN_FDNAMES="listen_fdnames"
}