summaryrefslogtreecommitdiff
path: root/test/system
diff options
context:
space:
mode:
authorMatej Vasek <mvasek@redhat.com>2021-06-28 21:17:13 +0200
committerMatej Vasek <mvasek@redhat.com>2021-07-01 12:01:46 +0200
commit86c6014145d5b8d4ea51f338beb9bddaa8b5a334 (patch)
tree056769253cf35f00bdd46389bddd9c076c31a00e /test/system
parentfd1715568b7c14451dcf2581c385c8d3e307d30e (diff)
downloadpodman-86c6014145d5b8d4ea51f338beb9bddaa8b5a334.tar.gz
podman-86c6014145d5b8d4ea51f338beb9bddaa8b5a334.tar.bz2
podman-86c6014145d5b8d4ea51f338beb9bddaa8b5a334.zip
Implement --archive flag for podman cp
Signed-off-by: Matej Vasek <mvasek@redhat.com>
Diffstat (limited to 'test/system')
-rw-r--r--test/system/065-cp.bats21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/system/065-cp.bats b/test/system/065-cp.bats
index eda04611f..5778eb46e 100644
--- a/test/system/065-cp.bats
+++ b/test/system/065-cp.bats
@@ -114,7 +114,7 @@ load helpers
}
-@test "podman cp file from host to container and check ownership" {
+@test "podman cp (-a=true) file from host to container and check ownership" {
srcdir=$PODMAN_TMPDIR/cp-test-file-host-to-ctr
mkdir -p $srcdir
content=cp-user-test-$(random_string 10)
@@ -129,6 +129,25 @@ load helpers
run_podman rm -f cpcontainer
}
+@test "podman cp (-a=false) file from host to container and check ownership" {
+ local tmpdir="${PODMAN_TMPDIR}/cp-test-file-host-to-ctr"
+ mkdir -p "${tmpdir}"
+
+ pushd "${tmpdir}"
+ touch a.txt
+ tar --owner=1042 --group=1043 -cf a.tar a.txt
+ popd
+
+ userid=$(id -u)
+
+ run_podman run --user="$userid" --userns=keep-id -d --name cpcontainer $IMAGE sleep infinity
+ run_podman cp -a=false - cpcontainer:/tmp/ < "${tmpdir}/a.tar"
+ run_podman exec cpcontainer stat -c "%u:%g" /tmp/a.txt
+ is "$output" "1042:1043" "copied file retains uid/gid from the tar"
+ run_podman kill cpcontainer
+ run_podman rm -f cpcontainer
+}
+
@test "podman cp file from/to host while --pid=host" {
if is_rootless && ! is_cgroupsv2; then