summaryrefslogtreecommitdiffstats
path: root/tests/bugs/quota
diff options
context:
space:
mode:
authorvmallika <vmallika@redhat.com>2015-05-28 12:30:02 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2015-05-28 23:29:07 -0700
commitf6e72c45ad754073bc8269e954d236bab9e4a0e7 (patch)
treebd2ab7c55e85aab08cfbf6ccaa151ea1158e97ac /tests/bugs/quota
parente3408108e36dac08d217f558b5cc69dff71bbcbf (diff)
Quota: fix testcases not to send parallel writes for accurate
quota enforcement This is a backport of http://review.gluster.org/#/c/10878 > Currently quota enforcer doesn't consider parallel writes > and allows quota to exceed limit where there are high rate > of parallel writes. Bug# 1223658 tracks the issue. > > This patch fixes the spurious failures by not sending > parallel writes. > Using O_SYNC and O_APPEND flags and block size > not more that 256k (For higher block size NFS client > splits the block into 256k chinks and does parallel writes) > > Change-Id: I297c164b030cecb87ce5b494c02b09e8b073b276 > BUG: 1223798 > Signed-off-by: vmallika <vmallika@redhat.com> > Reviewed-on: http://review.gluster.org/10878 > Tested-by: NetBSD Build System > Tested-by: Gluster Build System <jenkins@build.gluster.com> > Reviewed-by: Raghavendra G <rgowdapp@redhat.com> > Tested-by: Raghavendra G <rgowdapp@redhat.com> Change-Id: I78b6250eb0b3fbbbab1d4348d4e81d6292c6c6bb BUG: 1224894 Signed-off-by: vmallika <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/10910 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'tests/bugs/quota')
-rw-r--r--tests/bugs/quota/bug-1023974.t11
-rw-r--r--tests/bugs/quota/bug-1038598.t12
-rw-r--r--tests/bugs/quota/bug-1087198.t15
-rw-r--r--tests/bugs/quota/inode-quota.t13
4 files changed, 36 insertions, 15 deletions
diff --git a/tests/bugs/quota/bug-1023974.t b/tests/bugs/quota/bug-1023974.t
index 06b66bf35a3..2fb93320045 100644
--- a/tests/bugs/quota/bug-1023974.t
+++ b/tests/bugs/quota/bug-1023974.t
@@ -9,6 +9,10 @@
cleanup;
+QDD=$(dirname $0)/quota
+# compile the test write program and run it
+build_tester $(dirname $0)/../../basic/quota.c -o $QDD
+
TEST glusterd
TEST pidof glusterd;
TEST $CLI volume info;
@@ -26,13 +30,16 @@ TEST $CLI volume quota $V0 hard-timeout 0
TEST $CLI volume quota $V0 soft-timeout 0
#The corresponding write(3) should fail with EDQUOT ("Disk quota exceeded")
-TEST ! dd if=/dev/urandom of=$M0/1/2/file bs=1024k count=102;
+TEST ! $QDD $M0/1/2/file 256 408
TEST mkdir -p $M0/1/3;
-TEST dd if=/dev/urandom of=$M0/1/3/file bs=1024k count=102;
+TEST $QDD $M0/1/3/file 256 408
#The corresponding rename(3) should fail with EDQUOT ("Disk quota exceeded")
TEST ! mv $M0/1/3/ $M0/1/2/3_mvd;
TEST $CLI volume stop $V0
EXPECT "1" get_aux
+
+rm -f $QDD
+
cleanup;
diff --git a/tests/bugs/quota/bug-1038598.t b/tests/bugs/quota/bug-1038598.t
index d930a4f62e8..10fdb23424f 100644
--- a/tests/bugs/quota/bug-1038598.t
+++ b/tests/bugs/quota/bug-1038598.t
@@ -4,6 +4,10 @@
cleanup;
+QDD=$(dirname $0)/quota
+# compile the test write program and run it
+build_tester $(dirname $0)/../../basic/quota.c -o $QDD
+
TEST glusterd
TEST pidof glusterd
TEST $CLI volume info;
@@ -59,12 +63,12 @@ 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=1024k count=4
+TEST $QDD $M0/test_dir/file1.txt 256 16
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=1024k count=6
+TEST $QDD $M0/test_dir/file1.txt 256 24
EXPECT "6.0MB" usage "/test_dir";
EXPECT 'Yes' sl_exceeded "/test_dir";
EXPECT 'No' hl_exceeded "/test_dir";
@@ -73,10 +77,12 @@ EXPECT 'No' hl_exceeded "/test_dir";
TEST $CLI volume set $V0 features.hard-timeout 0
TEST $CLI volume set $V0 features.soft-timeout 0
-TEST ! dd if=/dev/zero of=$M0/test_dir/file1.txt bs=1024k count=15
+TEST ! $QDD $M0/test_dir/file1.txt 256 60
EXPECT 'Yes' sl_exceeded "/test_dir";
EXPECT 'Yes' hl_exceeded "/test_dir";
TEST $CLI volume stop $V0
EXPECT "1" get_aux
+rm -f $QDD
+
cleanup;
diff --git a/tests/bugs/quota/bug-1087198.t b/tests/bugs/quota/bug-1087198.t
index 6eaae076fcc..44aa1b75e7a 100644
--- a/tests/bugs/quota/bug-1087198.t
+++ b/tests/bugs/quota/bug-1087198.t
@@ -19,6 +19,10 @@
cleanup;
+QDD=$(dirname $0)/quota
+# compile the test write program and run it
+build_tester $(dirname $0)/../../basic/quota.c -o $QDD
+
#1
## Step 1
TEST glusterd
@@ -54,11 +58,11 @@ TEST $CLI volume quota $V0 limit-usage /$QUOTA_LIMIT_DIR 100KB
#16
## Step 3 and 4
-TEST dd if=/dev/urandom of=$N0/$QUOTA_LIMIT_DIR/95KB_file bs=1k count=95
+TEST $QDD $N0/$QUOTA_LIMIT_DIR/95KB_file 1 95
#Uncomment below TEST once the bug# 1202292 is fixed
#TEST grep -e "\"Usage crossed soft limit:.*used by /$QUOTA_LIMIT_DIR\"" -- $BRICK_LOG_DIR/*
-TEST dd if=/dev/urandom of=$N0/100KB_file bs=1k count=100
+TEST $QDD $N0/100KB_file 1 100
#Uncomment below TEST once the bug# 1202292 is fixed
#TEST grep -e "\"Usage crossed soft limit:.*used by /\"" -- $BRICK_LOG_DIR/*
@@ -67,11 +71,11 @@ TEST dd if=/dev/urandom of=$N0/100KB_file bs=1k count=100
TEST sleep 10
## Step 6
-TEST dd if=/dev/urandom of=$N0/$QUOTA_LIMIT_DIR/1KB_file bs=1k count=1
+TEST $QDD $N0/$QUOTA_LIMIT_DIR/1KB_file 1 1
TEST grep -e "\"Usage is above soft limit:.*used by /$QUOTA_LIMIT_DIR\"" -- $BRICK_LOG_DIR/*
#23
-TEST dd if=/dev/urandom of=$N0/1KB_file bs=1k count=1
+TEST $QDD $N0/1KB_file 1 1
TEST grep -e "\"Usage is above soft limit:.*used by /\"" -- $BRICK_LOG_DIR/*
#25
@@ -80,4 +84,7 @@ EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $N0
TEST $CLI volume stop $V0
EXPECT "1" get_aux
+
+rm -f $QDD
+
cleanup;
diff --git a/tests/bugs/quota/inode-quota.t b/tests/bugs/quota/inode-quota.t
index 58376d5058f..55a26fa0d2b 100644
--- a/tests/bugs/quota/inode-quota.t
+++ b/tests/bugs/quota/inode-quota.t
@@ -20,6 +20,10 @@ function quota_object_list_field () {
cleanup;
+QDD=$(dirname $0)/quota
+# compile the test write program and run it
+build_tester $(dirname $0)/../../basic/quota.c -o $QDD
+
TESTS_EXPECTED_IN_LOOP=9
TEST glusterd
@@ -81,18 +85,14 @@ EXPECT "10" quota_object_list_field "/test_dir" 2
# Check the quota enforcement mechanism for usage
#-----------------------------------------------------
-# Compile the program which basically created a file
-# of required size
-TEST $CC $(dirname $0)/../../basic/quota.c -o $(dirname $0)/quota
-
# try creating a 8MB file and it should fail
-TEST $(dirname $0)/quota $M0/test_dir/test1.txt '8388608'
+TEST $QDD $M0/test_dir/test1.txt 256 32
EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "8.0MB" quota_list_field "/test_dir" 2
TEST rm -f $M0/test_dir/test1.txt
EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "0Bytes" quota_list_field "/test_dir" 2
# try creating a 15MB file and it should succeed
-TEST ! $(dirname $0)/quota $M0/test_dir/test2.txt '15728640'
+TEST ! $QDD $M0/test_dir/test2.txt 256 60
TEST rm -f $M0/test_dir/test2.txt
@@ -130,4 +130,5 @@ TEST $CLI volume stop $V0
EXPECT "1" get_aux
TEST $CLI volume delete $V0
+rm -f $QDD
cleanup;