From dd9e406cf48142e7fa0619d17ccf3ecc71ce36ae Mon Sep 17 00:00:00 2001 From: Anuradha Date: Thu, 5 Dec 2013 19:02:10 +0530 Subject: 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 Signed-off-by: Anuradha Talur Reviewed-on: http://review.gluster.org/6441 Reviewed-by: Raghavendra G Tested-by: Gluster Build System --- tests/bugs/bug-1038598.t | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 tests/bugs/bug-1038598.t (limited to 'tests/bugs/bug-1038598.t') 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; -- cgit