From 46d4d7ade012f86044135dd4af3101f851484cda Mon Sep 17 00:00:00 2001 From: vmallika Date: Fri, 10 Jul 2015 14:37:50 +0530 Subject: features/quota : Fix spurious failure Problem : Basically, in this test case a file is created which exceeds the quota limit. Once the limit is reached that file will be deleted. At the same moment we are testing inode-quota. It can so happen that before the marker updates the information related to deletion of file, a new file creation operation comes and sees that quota limit is still exceeded. Solution : Inducing a check to see if marker updation completed successfully. Updated all the test case which has the similar machanism and also moved the "usage" function to a common place "volume.rc" Change-Id: I36ddbc5ebbf1b74c9d326a0d1d5f3b32f20a906a BUG: 1229297 Signed-off-by: Sachin Pandit Signed-off-by: vmallika Reviewed-on: http://review.gluster.org/11125 Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: Krishnan Parthasarathi --- tests/basic/quota.t | 42 ++++++++++++------------------------------ 1 file changed, 12 insertions(+), 30 deletions(-) (limited to 'tests/basic/quota.t') diff --git a/tests/basic/quota.t b/tests/basic/quota.t index 5552c4fdc3d..ec8fa0afcb9 100755 --- a/tests/basic/quota.t +++ b/tests/basic/quota.t @@ -20,24 +20,6 @@ TEST $CLI volume info; TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2,3,4}; -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}' -} - EXPECT "$V0" volinfo_field $V0 'Volume Name'; EXPECT 'Created' volinfo_field $V0 'Status'; EXPECT '4' brick_count $V0 @@ -58,16 +40,16 @@ TEST $CLI volume quota $V0 limit-usage /test_dir 100MB TEST $CLI volume quota $V0 limit-usage /test_dir/in_test_dir 150MB -EXPECT "150.0MB" hard_limit "/test_dir/in_test_dir"; -EXPECT "80%" soft_limit "/test_dir/in_test_dir"; +EXPECT "150.0MB" quota_hard_limit "/test_dir/in_test_dir"; +EXPECT "80%" quota_soft_limit "/test_dir/in_test_dir"; TEST $CLI volume quota $V0 remove /test_dir/in_test_dir -EXPECT "100.0MB" hard_limit "/test_dir"; +EXPECT "100.0MB" quota_hard_limit "/test_dir"; TEST $CLI volume quota $V0 limit-usage /test_dir 10MB -EXPECT "10.0MB" hard_limit "/test_dir"; -EXPECT "80%" soft_limit "/test_dir"; +EXPECT "10.0MB" quota_hard_limit "/test_dir"; +EXPECT "80%" quota_soft_limit "/test_dir"; TEST $CLI volume quota $V0 soft-timeout 0 TEST $CLI volume quota $V0 hard-timeout 0 @@ -81,20 +63,20 @@ TEST ! $QDD $M0/test_dir/1.txt 256 48 TEST rm $M0/test_dir/1.txt # wait for marker's accounting to complete -EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "0Bytes" usage "/test_dir" +EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "0Bytes" quotausage "/test_dir" TEST $QDD $M0/test_dir/2.txt 256 32 -EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "8.0MB" usage "/test_dir" +EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "8.0MB" quotausage "/test_dir" TEST rm $M0/test_dir/2.txt -EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "0Bytes" usage "/test_dir" +EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "0Bytes" quotausage "/test_dir" ## rename tests TEST $QDD $M0/test_dir/2 256 32 -EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "8.0MB" usage "/test_dir" +EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "8.0MB" quotausage "/test_dir" TEST mv $M0/test_dir/2 $M0/test_dir/0 -EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "8.0MB" usage "/test_dir" +EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "8.0MB" quotausage "/test_dir" TEST rm $M0/test_dir/0 -EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "0Bytes" usage "/test_dir" +EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "0Bytes" quotausage "/test_dir" ## --------------------------- @@ -112,7 +94,7 @@ TEST $CLI volume quota $V0 limit-usage /test_dir 100MB TEST $CLI volume quota $V0 limit-usage /test_dir/in_test_dir 150MB -EXPECT "150.0MB" hard_limit "/test_dir/in_test_dir"; +EXPECT "150.0MB" quota_hard_limit "/test_dir/in_test_dir"; ## ----------------------------- -- cgit