summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAnuradha <atalur@redhat.com>2013-12-05 19:02:10 +0530
committerAnand Avati <avati@redhat.com>2014-02-08 11:40:21 -0800
commitdd9e406cf48142e7fa0619d17ccf3ecc71ce36ae (patch)
treee09665186abc10a9518f77daed8f8265390ae907 /tests
parent1e26f070bb470adafd0a316c18f2fb9e1b103f27 (diff)
quota : changes in quota list command
Changes are made to quota list command such that it also shows whether hard-limit and soft-limit are exceeded or not. A test case to check the same is added. Change-Id: Idb365acfc5d1f2d9f3373dd5f98573d5fe87b50f BUG: 1038598 Signed-off-by: Anuradha <atalur@redhat.com> Signed-off-by: Anuradha Talur <atalur@redhat.com> Reviewed-on: http://review.gluster.org/6441 Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/bug-1038598.t76
1 files changed, 76 insertions, 0 deletions
diff --git a/tests/bugs/bug-1038598.t b/tests/bugs/bug-1038598.t
new file mode 100644
index 00000000000..22790ad04a7
--- /dev/null
+++ b/tests/bugs/bug-1038598.t
@@ -0,0 +1,76 @@
+#!/bin/bash
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+
+cleanup;
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume info;
+
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2};
+
+function hard_limit()
+{
+ local QUOTA_PATH=$1;
+ $CLI volume quota $V0 list $QUOTA_PATH | grep "$QUOTA_PATH" | awk '{print $2}'
+}
+
+function soft_limit()
+{
+ local QUOTA_PATH=$1;
+ $CLI volume quota $V0 list $QUOTA_PATH | grep "$QUOTA_PATH" | awk '{print $3}'
+}
+
+function usage()
+{
+ local QUOTA_PATH=$1;
+ $CLI volume quota $V0 list $QUOTA_PATH | grep "$QUOTA_PATH" | awk '{print $4}'
+}
+
+function sl_exceeded()
+{
+ local QUOTA_PATH=$1;
+ $CLI volume quota $V0 list $QUOTA_PATH | grep "$QUOTA_PATH" | awk '{print $6}'
+}
+
+function hl_exceeded()
+{
+ local QUOTA_PATH=$1;
+ $CLI volume quota $V0 list $QUOTA_PATH | grep "$QUOTA_PATH" | awk '{print $7}'
+
+}
+
+EXPECT "$V0" volinfo_field $V0 'Volume Name';
+EXPECT 'Created' volinfo_field $V0 'Status';
+EXPECT '2' brick_count $V0
+
+TEST $CLI volume start $V0;
+EXPECT 'Started' volinfo_field $V0 'Status';
+
+TEST $CLI volume quota $V0 enable
+sleep 5
+
+TEST glusterfs -s $H0 --volfile-id $V0 $M0;
+
+TEST mkdir -p $M0/test_dir
+TEST $CLI volume quota $V0 limit-usage /test_dir 10MB 50
+
+EXPECT "10.0MB" hard_limit "/test_dir";
+EXPECT "50%" soft_limit "/test_dir";
+
+TEST dd if=/dev/zero of=$M0/test_dir/file1.txt bs=1M count=4
+EXPECT "4.0MB" usage "/test_dir";
+EXPECT 'No' sl_exceeded "/test_dir";
+EXPECT 'No' hl_exceeded "/test_dir";
+
+TEST dd if=/dev/zero of=$M0/test_dir/file1.txt bs=1M count=6
+EXPECT "6.0MB" usage "/test_dir";
+EXPECT 'Yes' sl_exceeded "/test_dir";
+EXPECT 'No' hl_exceeded "/test_dir";
+
+TEST ! dd if=/dev/zero of=$M0/test_dir/file1.txt bs=1M count=15
+EXPECT 'Yes' sl_exceeded "/test_dir";
+EXPECT 'Yes' hl_exceeded "/test_dir";
+
+cleanup;