summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVijay Bellur <vbellur@redhat.com>2013-08-12 11:22:19 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2013-08-12 15:54:37 +0530
commit961750a6dd0175ed51f7e00164df6cdc610d4d3a (patch)
tree42e8b9c2cc23f16f08de385d6841acee82b74587
parent1ceb5f40efc76caed3bf6272e2f96ba7f2c610a5 (diff)
tests/basic: Improve quota.t to include enforcement testsorigin/upstream_on_quota
Change-Id: I7fce33e7d1c075b9610df7f6e9db1cc862630170 BUG: 969461 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
-rwxr-xr-xtests/basic/quota.t44
1 files changed, 38 insertions, 6 deletions
diff --git a/tests/basic/quota.t b/tests/basic/quota.t
index ef015a3..9f4fe5d 100755
--- a/tests/basic/quota.t
+++ b/tests/basic/quota.t
@@ -9,21 +9,31 @@ TEST glusterd
TEST pidof glusterd
TEST $CLI volume info;
-TEST $CLI volume create $V0 replica 2 stripe 2 $H0:$B0/${V0}{1,2,3,4,5,6,7,8};
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2,3,4};
function limit_on()
{
local QUOTA_PATH=$1;
- $CLI volume quota $V0 list | grep "$QUOTA_PATH" | awk '{print $2}'
+ $CLI volume quota $V0 list $QUOTA_PATH | grep "$QUOTA_PATH" | awk '{print $2}'
+}
+
+function usage()
+{
+ local QUOTA_PATH=$1;
+ $CLI volume quota $V0 list $QUOTA_PATH | grep "$QUOTA_PATH" | awk '{print $4}'
}
EXPECT "$V0" volinfo_field $V0 'Volume Name';
EXPECT 'Created' volinfo_field $V0 'Status';
-EXPECT '8' brick_count $V0
+EXPECT '4' brick_count $V0
TEST $CLI volume start $V0;
EXPECT 'Started' volinfo_field $V0 'Status';
+TEST glusterfs -s $H0 --volfile-id $V0 $M0;
+
+TEST mkdir -p $M0/test_dir/in_test_dir
+
## ------------------------------
## Verify quota commands
## ------------------------------
@@ -33,15 +43,37 @@ TEST $CLI volume quota $V0 limit-usage /test_dir 100MB
TEST $CLI volume quota $V0 limit-usage /test_dir/in_test_dir 150MB
-EXPECT "150MB" limit_on "/test_dir/in_test_dir";
+EXPECT "150.0MB" limit_on "/test_dir/in_test_dir";
TEST $CLI volume quota $V0 remove /test_dir/in_test_dir
-EXPECT "100MB" limit_on "/test_dir";
+EXPECT "100.0MB" limit_on "/test_dir";
+
+TEST $CLI volume quota $V0 limit-usage /test_dir 10MB
+EXPECT "10.0MB" limit_on "/test_dir";
+
+TEST $CLI volume quota $V0 soft-timeout 0
+TEST $CLI volume quota $V0 hard-timeout 0
-TEST $CLI volume quota $V0 disable
## ------------------------------
+## Verify quota enforcement
+## -----------------------------
+
+TEST ! dd if=/dev/urandom of=$M0/test_dir/1.txt bs=1M count=12
+TEST rm $M0/test_dir/1.txt
+
+# wait for marker's accounting to complete
+EXPECT_WITHIN 10 "0Bytes" usage "/test_dir"
+
+TEST dd if=/dev/urandom of=$M0/test_dir/2.txt bs=1M count=8
+EXPECT "8.0MB" usage "/test_dir"
+TEST rm $M0/test_dir/2.txt
+## ---------------------------
+
+EXPECT "0Bytes" usage "/test_dir"
+
+TEST $CLI volume quota $V0 disable
TEST $CLI volume stop $V0;
EXPECT 'Stopped' volinfo_field $V0 'Status';