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..fe0ee86f98 100644 --- a/tests/bud/volume-ownership/Dockerfile +++ b/tests/bud/volume-ownership/Dockerfile @@ -1,7 +1,10 @@ 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 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 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" ]]