From c09bbe8e068cb0648242a9345f2f22a6d1db90e0 Mon Sep 17 00:00:00 2001 From: haircommander Date: Wed, 27 Jun 2018 13:45:08 -0400 Subject: Test to verify overlay quotas work, show container overhead on quota Signed-off-by: haircommander Closes: #1013 Approved by: rhatdan --- test/test_podman_baseline.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) mode change 100644 => 100755 test/test_podman_baseline.sh (limited to 'test/test_podman_baseline.sh') diff --git a/test/test_podman_baseline.sh b/test/test_podman_baseline.sh old mode 100644 new mode 100755 index 59bcb0e84..144314358 --- a/test/test_podman_baseline.sh +++ b/test/test_podman_baseline.sh @@ -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 -- cgit v1.2.3-54-g00ecf