summaryrefslogtreecommitdiff
path: root/test/system
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-07-01 13:15:00 -0400
committerGitHub <noreply@github.com>2021-07-01 13:15:00 -0400
commit955c1d2bfeac0c399bbc4d82fd7b72ed4cc868d3 (patch)
tree1758a6acf60589fa13ae95dd39e3a0e1ddc78c13 /test/system
parenta855b30f81cc72e67fc40b7301b98124ab0e6d01 (diff)
parent86c6014145d5b8d4ea51f338beb9bddaa8b5a334 (diff)
downloadpodman-955c1d2bfeac0c399bbc4d82fd7b72ed4cc868d3.tar.gz
podman-955c1d2bfeac0c399bbc4d82fd7b72ed4cc868d3.tar.bz2
podman-955c1d2bfeac0c399bbc4d82fd7b72ed4cc868d3.zip
Merge pull request #10804 from matejvasek/fix-cp-sub-cmd
Implement --archive flag for podman cp
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