From 86c6014145d5b8d4ea51f338beb9bddaa8b5a334 Mon Sep 17 00:00:00 2001 From: Matej Vasek Date: Mon, 28 Jun 2021 21:17:13 +0200 Subject: Implement --archive flag for podman cp Signed-off-by: Matej Vasek --- test/system/065-cp.bats | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'test/system') 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 -- cgit v1.2.3-54-g00ecf