From 10e59b5b31f34623696de24fb9f0a46c8ed6167a Mon Sep 17 00:00:00 2001 From: Nick Carboni Date: Thu, 19 Mar 2020 09:27:52 -0400 Subject: [PATCH 1/2] Run stat command directly for volume ownership test This removes the script previously used which may have been causing #2235 Signed-off-by: Nick Carboni --- tests/bud.bats | 3 ++- tests/bud/volume-ownership/Dockerfile | 1 - tests/bud/volume-ownership/test-ownership | 6 ------ 3 files changed, 2 insertions(+), 8 deletions(-) delete mode 100755 tests/bud/volume-ownership/test-ownership diff --git a/tests/bud.bats b/tests/bud.bats index b5dd012a95..c3ba820e0e 100644 --- a/tests/bud.bats +++ b/tests/bud.bats @@ -608,7 +608,8 @@ load helpers run_buildah bud --signature-policy ${TESTSDIR}/policy.json -t ${target} ${TESTSDIR}/bud/volume-ownership run_buildah from --quiet --signature-policy ${TESTSDIR}/policy.json ${target} cid=$output - run_buildah run $cid test-ownership + run_buildah run $cid stat -c "%U %G" /vol/subvol + expect_output "testuser testgroup" } @test "bud-from-glob" { diff --git a/tests/bud/volume-ownership/Dockerfile b/tests/bud/volume-ownership/Dockerfile index 4a113dfb0c..96be4b7921 100644 --- a/tests/bud/volume-ownership/Dockerfile +++ b/tests/bud/volume-ownership/Dockerfile @@ -1,5 +1,4 @@ FROM alpine -ADD test-ownership /usr/bin/ RUN adduser -D -H testuser && addgroup testgroup RUN mkdir -p /vol/subvol RUN chown testuser:testgroup /vol/subvol diff --git a/tests/bud/volume-ownership/test-ownership b/tests/bud/volume-ownership/test-ownership deleted file mode 100755 index f07d23b869..0000000000 --- a/tests/bud/volume-ownership/test-ownership +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -set -e - -MY_USER=$(stat -c "%U" /vol/subvol) && [[ "$MY_USER" == "testuser" ]] -MY_GROUP=$(stat -c "%G" /vol/subvol) && [[ "$MY_GROUP" == "testgroup" ]] From 85fe5cc410a7264d10d35f960428f125bdc21f5c Mon Sep 17 00:00:00 2001 From: Nick Carboni Date: Thu, 19 Mar 2020 10:05:07 -0400 Subject: [PATCH 2/2] Add comment for RUN command in volume ownership test Signed-off-by: Nick Carboni --- tests/bud/volume-ownership/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/bud/volume-ownership/Dockerfile b/tests/bud/volume-ownership/Dockerfile index 96be4b7921..fe0ee86f98 100644 --- a/tests/bud/volume-ownership/Dockerfile +++ b/tests/bud/volume-ownership/Dockerfile @@ -3,4 +3,8 @@ RUN adduser -D -H testuser && addgroup testgroup RUN mkdir -p /vol/subvol RUN chown testuser:testgroup /vol/subvol VOLUME /vol/subvol + +# Run some command after VOLUME to ensure that the volume cache behavior is invoked +# See https://github.com/containers/buildah/blob/843d15de3e797bd912607d27324d13a9d5c27dfb/imagebuildah/stage_executor.go#L61-L72 and +# for more details RUN touch /test