[lxc-devel] [lxd/master] test: Adds storage quota tests
tomponline on Github
lxc-bot at linuxcontainers.org
Thu Sep 5 10:37:09 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 442 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190905/7cb32363/attachment.bin>
-------------- next part --------------
From c8c99a261775ea8e9b7406ef4b005568114291f5 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Thu, 5 Sep 2019 11:36:10 +0100
Subject: [PATCH] test: Adds storage quota tests
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
test/suites/storage.sh | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/test/suites/storage.sh b/test/suites/storage.sh
index 5a3e43a081..64b91df65a 100644
--- a/test/suites/storage.sh
+++ b/test/suites/storage.sh
@@ -761,10 +761,20 @@ test_storage() {
# Test applying quota
QUOTA1="10GB"
+ rootMinKB1="9767000"
+ rootMaxKB1="9999999"
+
QUOTA2="11GB"
+ rootMinKB2="10744000"
+ rootMaxKB2="10744999"
+
if [ "$lxd_backend" = "lvm" ]; then
QUOTA1="20MB"
+ rootMinKB1="17000"
+ rootMaxKB1="20000"
QUOTA2="21MB"
+ rootMinKB2="21000"
+ rootMaxKB2="23000"
fi
if [ "$lxd_backend" != "dir" ] && [ "$lxd_backend" != "ceph" ]; then
@@ -773,6 +783,14 @@ test_storage() {
lxc stop -f quota1
lxc start quota1
+ if [ "$lxd_backend" != "btrfs" ]; then
+ rootSizeKB=$(lxc exec quota1 -- df -P / | tail -n1 | awk '{print $2}')
+ if [ "$rootSizeKB" -gt "$rootMaxKB1" ] || [ "$rootSizeKB" -lt "$rootMinKB1" ] ; then
+ echo "root size not within quota range"
+ false
+ fi
+ fi
+
lxc launch testimage quota2
lxc stop -f quota2
lxc start quota2
@@ -787,6 +805,13 @@ test_storage() {
lxc stop -f quota2
lxc start quota2
+ if [ "$lxd_backend" != "btrfs" ]; then
+ rootSizeKB=$(lxc exec quota2 -- df -P / | tail -n1 | awk '{print $2}')
+ if [ "$rootSizeKB" -gt "$rootMaxKB2" ] || [ "$rootSizeKB" -lt "$rootMinKB2" ] ; then
+ echo "root size not within quota range"
+ false
+ fi
+ fi
lxc stop -f quota3
lxc start quota3
More information about the lxc-devel
mailing list