summaryrefslogtreecommitdiff
path: root/test/system
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-01-07 20:38:59 +0100
committerGitHub <noreply@github.com>2022-01-07 20:38:59 +0100
commit41934acc51c5046a56b17158d7f2b735961864ce (patch)
tree99a6768250c51635a7d3602e2f657a88b94b7fca /test/system
parent0464011a8ea705b31cf270407e76608c223c2f21 (diff)
parent13f3fd2555b1f02af4c183ef51d1707af1198eb9 (diff)
downloadpodman-41934acc51c5046a56b17158d7f2b735961864ce.tar.gz
podman-41934acc51c5046a56b17158d7f2b735961864ce.tar.bz2
podman-41934acc51c5046a56b17158d7f2b735961864ce.zip
Merge pull request #12733 from rhatdan/copy
Set volume NeedsCopyUp to false iff data was copied up
Diffstat (limited to 'test/system')
-rw-r--r--test/system/160-volumes.bats40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/system/160-volumes.bats b/test/system/160-volumes.bats
index 1271b7c0b..b6030ba3c 100644
--- a/test/system/160-volumes.bats
+++ b/test/system/160-volumes.bats
@@ -345,4 +345,44 @@ EOF
is "$output" "tmpfs" "volume should be tmpfs"
}
+# Named volumes copyup
+@test "podman volume create copyup" {
+ myvolume=myvol$(random_string)
+ mylabel=$(random_string)
+
+ # Create a named volume
+ run_podman volume create $myvolume
+ is "$output" "$myvolume" "output from volume create"
+
+ # Confirm that it shows up in 'volume ls', and confirm values
+ run_podman volume ls --format json
+ tests="
+Name | $myvolume
+Driver | local
+NeedsCopyUp | true
+NeedsChown | true
+"
+ parse_table "$tests" | while read field expect; do
+ actual=$(jq -r ".[0].$field" <<<"$output")
+ is "$actual" "$expect" "volume ls .$field"
+ done
+
+ run_podman run --rm --volume $myvolume:/vol $IMAGE true
+ run_podman volume inspect --format '{{ .NeedsCopyUp }}' $myvolume
+ is "${output}" "true" "If content in dest '/vol' empty NeedsCopyUP should still be true"
+ run_podman volume inspect --format '{{ .NeedsChown }}' $myvolume
+ is "${output}" "false" "After first use within a container NeedsChown should still be false"
+
+ run_podman run --rm --volume $myvolume:/etc $IMAGE ls /etc/passwd
+ run_podman volume inspect --format '{{ .NeedsCopyUp }}' $myvolume
+ is "${output}" "false" "If content in dest '/etc' non-empty NeedsCopyUP should still have happend and be false"
+
+ run_podman volume inspect --format '{{.Mountpoint}}' $myvolume
+ mountpoint="$output"
+ test -e "$mountpoint/passwd"
+
+ # Clean up
+ run_podman volume rm $myvolume
+}
+
# vim: filetype=sh