]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: extend quota test case
authorYunchuan Wen <yunchuanwen@ubuntukylin.com>
Mon, 24 Nov 2014 08:29:35 +0000 (16:29 +0800)
committerYunchuan Wen <yunchuanwen@ubuntukylin.com>
Mon, 24 Nov 2014 08:29:35 +0000 (16:29 +0800)
Signed-off-by: Yunchuan Wen <yunchuanwen@ubuntukylin.com>
qa/workunits/fs/misc/quota.sh

index a098c495f3f377fc584a63c892e1e1398f9125c8..67319b7acb0730e953620fc43ea814d697846bde 100755 (executable)
@@ -17,7 +17,67 @@ setfattr . -n ceph.quota.max_bytes -v 0
 dd if=/dev/zero of=third bs=1M count=10
 dd if=/dev/zero of=big2 bs=1M count=100
 
+
+rm -rf *
+
 # files
+setfattr . -n ceph.quota.max_files -v 5
+mkdir ok
+touch ok/1
+touch ok/2
+touch 3
+expect_false touch shouldbefail     #  5 files will include the "."
+expect_false touch ok/shouldbefail  #  5 files will include the "."
+setfattr . -n ceph.quota.max_files -v 0
+touch shouldbecreated
+touch shouldbecreated2
+
+
+rm -rf *
+
+# mix
+mkdir bytes bytes/files
+
+setfattr bytes -n ceph.quota.max_bytes -v 10000000   #10m
+setfattr bytes/files -n ceph.quota.max_files -v 5
+dd if=/dev/zero of=bytes/files/1 bs=1M count=4
+dd if=/dev/zero of=bytes/files/2 bs=1M count=4
+expect_false dd if=/dev/zero of=bytes/files/3 bs=1M count=1000
+expect_false dd if=/dev/zero of=bytes/files/4 bs=1M count=1000
+expect_false dd if=/dev/zero of=bytes/files/5 bs=1M count=1000
+stat --printf="%n %s\n" bytes/files/1 #4M
+stat --printf="%n %s\n" bytes/files/2 #4M
+stat --printf="%n %s\n" bytes/files/3 #bigger than 2M
+stat --printf="%n %s\n" bytes/files/4 #should be zero
+expect_false stat bytes/files/5       #shouldn't be exist
+
+mv bytes/files .
+dd if=/dev/zero of=files/3 bs=1M count=4
+dd if=/dev/zero of=files/4 bs=1M count=4
+expect_false dd if=/dev/zero of=files/5 bs=1M count=4
+
+
+
+rm -rf *
+
+#mv
+mkdir files limit
+dd if=/dev/zero of=files/file bs=1M count=100
+setfattr limit -n ceph.quota.max_bytes -v 1000000 #1m
+expect_false mv files limit/
+
+
+
+rm -rf *
+
+#limit by ancestor
+
+mkdir -p ancestor/p1/p2/parent/p3
+setfattr ancestor -n ceph.quota.max_bytes -v 1000000
+setfattr ancestor/p1/p2/parent -n ceph.quota.max_bytes -v 1000000000 #1g
+expect_false dd if=/dev/zero of=ancestor/p1/p2/parent/p3/file1 bs=1M count=900 #900m
+stat --printf="%n %s\n" ancestor/p1/p2/parent/p3/file1
+
 #addme
 
 cd ..