Test to verify overlay quotas work, show container overhead on quota

Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1013
Approved by: rhatdan
This commit is contained in:
haircommander 2018-06-27 13:45:08 -04:00 committed by Atomic Bot
parent c9eddd22eb
commit c09bbe8e06
1 changed files with 48 additions and 0 deletions

48
test/test_podman_baseline.sh Normal file → Executable file
View File

@ -194,3 +194,51 @@ podman run whale-says
podman rm --all
podman rmi --all
rm ./Dockerfile
########
# Set up xfs mount for overlay quota
########
# 1.004608 MB is 1,004,608 bytes. The container overhead is 4608 bytes (or 9 512 byte pages), so this allocates 1 MB of usable storage
PODMANBASE="-s overlay --storage-opt overlay.size=1.004608M --root /tmp/podman_test/crio"
TMPDIR=/tmp/podman_test
mkdir $TMPDIR
dd if=/dev/zero of=$TMPDIR/virtfs bs=1024 count=30720
device=$(losetup -f | tr -d '[:space:]')
losetup $device $TMPDIR/virtfs
mkfs.xfs $device
mount -t xfs -o prjquota $device $TMPDIR
########
# Expected to succeed
########
podman $PODMANBASE run --security-opt label=disable alpine sh -c 'touch file.txt && dd if=/dev/zero of=file.txt count=1048576 bs=1'
rc=$?
if [ $rc == 0 ];
then
echo "Overlay test within limits passed"
else
echo "Overlay test within limits failed"
fi
########
# Expected to fail
########
podman $PODMANBASE run --security-opt label=disable alpine sh -c 'touch file.txt && dd if=/dev/zero of=file.txt count=1048577 bs=1'
rc=$?
if [ $rc != 0 ];
then
echo "Overlay test outside limits passed"
else
echo "Overlay test outside limits failed"
fi
########
# Clean up Podman and /tmp
########
podman rm --all
podman rmi --all
umount $TMPDIR -l
losetup -d $device
rm -rf /tmp/podman_test