summaryrefslogtreecommitdiff
path: root/test/system
diff options
context:
space:
mode:
authorHironori Shiina <shiina.hironori@jp.fujitsu.com>2022-06-08 17:40:44 -0400
committerMatthew Heon <mheon@redhat.com>2022-06-14 16:12:10 -0400
commit8ed9aaba6dbf7190990ce7ba1b190ea9e96f48e4 (patch)
treeed04e3618647a56d9d828680281376d7487b6194 /test/system
parentf15819f25e880ec3d9d1d38d724d77450f8d23ec (diff)
downloadpodman-8ed9aaba6dbf7190990ce7ba1b190ea9e96f48e4.tar.gz
podman-8ed9aaba6dbf7190990ce7ba1b190ea9e96f48e4.tar.bz2
podman-8ed9aaba6dbf7190990ce7ba1b190ea9e96f48e4.zip
Pass '--file-locks' to OCI runtime at restoring
`podman container restore --file-locks` does not restore file locks because this option is not passed to OCI runtime. This patch fixes this issue. Signed-off-by: Hironori Shiina <shiina.hironori@jp.fujitsu.com>
Diffstat (limited to 'test/system')
-rw-r--r--test/system/520-checkpoint.bats30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/system/520-checkpoint.bats b/test/system/520-checkpoint.bats
index c16a8c35d..7f60f01b3 100644
--- a/test/system/520-checkpoint.bats
+++ b/test/system/520-checkpoint.bats
@@ -170,4 +170,34 @@ function teardown() {
# FIXME: test --leave-running
+@test "podman checkpoint --file-locks" {
+ action='flock test.lock sh -c "while [ -e /wait ];do sleep 0.5;done;for i in 1 2 3;do echo \$i;sleep 0.5;done"'
+ run_podman run -d $IMAGE sh -c "touch /wait; touch test.lock; echo READY; $action & $action & wait"
+ local cid="$output"
+
+ # Wait for container to start emitting output
+ wait_for_ready $cid
+
+ # Checkpoint, and confirm via inspect
+ run_podman container checkpoint --file-locks $cid
+ is "$output" "$cid" "podman container checkpoint"
+
+ run_podman container inspect \
+ --format '{{.State.Status}}:{{.State.Running}}:{{.State.Paused}}:{{.State.Checkpointed}}' $cid
+ is "$output" "exited:false:false:true" "State. Status:Running:Pause:Checkpointed"
+
+ # Restart immediately and confirm state
+ run_podman container restore --file-locks $cid
+ is "$output" "$cid" "podman container restore"
+
+ # Signal the container to continue; this is where the 1-2-3s will come from
+ run_podman exec $cid rm /wait
+
+ # Wait for the container to stop
+ run_podman wait $cid
+
+ run_podman logs $cid
+ trim=$(sed -z -e 's/[\r\n]\+//g' <<<"$output")
+ is "$trim" "READY123123" "File lock restored"
+}
# vim: filetype=sh