diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2021-09-06 14:49:59 +0200 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2021-09-07 13:58:11 +0200 |
commit | d1573b95e3427efae21da784e3112c5fb3d463fb (patch) | |
tree | da311feeab3105d4577a7d5c4a9a1dc3027603aa /test/system | |
parent | e095667ac8c2ccaf06dea6d4c61f51d93b736968 (diff) | |
download | podman-d1573b95e3427efae21da784e3112c5fb3d463fb.tar.gz podman-d1573b95e3427efae21da784e3112c5fb3d463fb.tar.bz2 podman-d1573b95e3427efae21da784e3112c5fb3d463fb.zip |
generate systemd: handle --restart
Handle custom restart policies of containers when generating the unit
files; those should be set on the unit level and removed from ExecStart
flags.
Fixes: #11438
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'test/system')
-rw-r--r-- | test/system/250-systemd.bats | 23 |
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" } |