From d94b39a8e6080e51f7281d545f11514829c1265c Mon Sep 17 00:00:00 2001 From: vmallika Date: Wed, 15 Jul 2015 15:17:31 +0530 Subject: quota: fix quota test case Below command is wrong way of executing mutilple command with | (pipe) local cmd="$CLI volume quota $V0 list $QUOTA_PATH | grep $QUOTA_PATH | awk '{print \$$FIELD}'" $cmd This patch fixes the issue This patch also fixes testcase inode-quota.t, which checking quota values in wrongs fields Change-Id: If28732e6a76ea4bf75560f6496c8f56670915cf9 BUG: 1229297 Signed-off-by: vmallika Reviewed-on: http://review.gluster.org/11673 Tested-by: NetBSD Build System Reviewed-by: Raghavendra G --- tests/bugs/quota/inode-quota.t | 16 ++++++++-------- tests/volume.rc | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/bugs/quota/inode-quota.t b/tests/bugs/quota/inode-quota.t index cad63e1fd3c..edc2c1de512 100644 --- a/tests/bugs/quota/inode-quota.t +++ b/tests/bugs/quota/inode-quota.t @@ -73,14 +73,14 @@ EXPECT "10" quota_object_list_field "/test_dir" 2 # try creating a 8MB file and it should fail TEST $QDD $M0/test_dir/test1.txt 256 32 -EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "8.0MB" quota_list_field "/test_dir" 2 +EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "8.0MB" quotausage "/test_dir" TEST rm -f $M0/test_dir/test1.txt -EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "0Bytes" quota_list_field "/test_dir" 2 +EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "0Bytes" quotausage "/test_dir" -# try creating a 15MB file and it should succeed +# try creating a 15MB file and it should not succeed TEST ! $QDD $M0/test_dir/test2.txt 256 60 TEST rm -f $M0/test_dir/test2.txt -EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "0Bytes" quota_list_field "/test_dir" 2 +EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "0Bytes" quotausage "/test_dir" #------------------------------------------------------ @@ -94,16 +94,16 @@ EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "0Bytes" quota_list_field "/test_dir" 2 for i in {1..9}; do TEST_IN_LOOP touch $M0/test_dir/test$i.txt done -EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "10" quota_object_list_field "/test_dir" 4 +EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "9" quota_object_list_field "/test_dir" 4 # Check available limit -EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "0" quota_object_list_field "/test_dir" 5 +EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "0" quota_object_list_field "/test_dir" 6 # Check if hard-limit exceeded -EXPECT "Yes" quota_object_list_field "/test_dir" 7 +EXPECT "Yes" quota_object_list_field "/test_dir" 8 # Check if soft-limit exceeded -EXPECT "Yes" quota_object_list_field "/test_dir" 6 +EXPECT "Yes" quota_object_list_field "/test_dir" 7 # Creation of 11th file should throw out an error TEST ! touch $M0/test_dir/test11.txt diff --git a/tests/volume.rc b/tests/volume.rc index 4217c284345..54fdc354c4e 100644 --- a/tests/volume.rc +++ b/tests/volume.rc @@ -562,17 +562,17 @@ function drop_cache() { function quota_list_field () { local QUOTA_PATH=$1 local FIELD=$2 - local cmd="$CLI volume quota $V0 list $QUOTA_PATH | grep $QUOTA_PATH | awk '{print \$$FIELD}'" + local awk_arg="{print \$$FIELD}" - $cmd + $CLI volume quota $V0 list $QUOTA_PATH | grep $QUOTA_PATH | awk "$awk_arg" } function quota_object_list_field () { local QUOTA_PATH=$1 local FIELD=$2 - local cmd="$CLI volume quota $V0 list-objects $QUOTA_PATH | grep $QUOTA_PATH | awk '{print \$$FIELD}'" + local awk_arg="{print \$$FIELD}" - $cmd + $CLI volume quota $V0 list-objects $QUOTA_PATH | grep $QUOTA_PATH | awk "$awk_arg" } function quotausage() -- cgit