2019-04-29 21:41:18 +08:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
|
|
load helpers
|
|
|
|
|
|
|
|
|
|
@test "overlay specific level" {
|
2019-11-23 03:52:25 +08:00
|
|
|
if test \! -e /usr/bin/fuse-overlayfs -a "$BUILDAH_ISOLATION" = "rootless"; then
|
2019-07-29 23:48:35 +08:00
|
|
|
skip "BUILDAH_ISOLATION = $BUILDAH_ISOLATION" and no /usr/bin/fuse-overlayfs present
|
2019-04-29 21:41:18 +08:00
|
|
|
fi
|
|
|
|
|
image=alpine
|
|
|
|
|
mkdir ${TESTDIR}/lower
|
|
|
|
|
touch ${TESTDIR}/lower/foo
|
|
|
|
|
|
2019-12-12 03:11:08 +08:00
|
|
|
run_buildah from --quiet -v ${TESTDIR}/lower:/lower:O --quiet --signature-policy ${TESTSDIR}/policy.json $image
|
|
|
|
|
cid=$output
|
2019-04-29 21:41:18 +08:00
|
|
|
|
|
|
|
|
# This should succeed
|
2019-12-12 02:28:27 +08:00
|
|
|
run_buildah run $cid ls /lower/foo
|
2019-04-29 21:41:18 +08:00
|
|
|
|
|
|
|
|
# Create and remove content in the overlay directory, should succeed
|
2019-12-12 02:28:27 +08:00
|
|
|
run_buildah run $cid touch /lower/bar
|
|
|
|
|
run_buildah run $cid rm /lower/foo
|
2019-04-29 21:41:18 +08:00
|
|
|
|
|
|
|
|
# This should fail, second runs of containers go back to original
|
2019-12-12 02:28:27 +08:00
|
|
|
run_buildah 1 run $cid ls /lower/bar
|
2019-04-29 21:41:18 +08:00
|
|
|
|
|
|
|
|
# This should fail
|
|
|
|
|
run ls ${TESTDIR}/lower/bar
|
|
|
|
|
[ "$status" -ne 0 ]
|
|
|
|
|
}
|