Whamcloud - gitweb
LU-11885 test: reset quota upon test failed 08/34108/3
authorWang Shilong <wshilong@ddn.com>
Fri, 25 Jan 2019 02:05:41 +0000 (10:05 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 21 Mar 2019 03:43:30 +0000 (03:43 +0000)
Currently if test fail, EXIT will be trapped and
cleanup_quota_test() will be called to cleanup dirs.

However, we didn't reset quota in this case, this might
make following test fail because of this.

Also cleanup duplicated lines sine we have done reseting
inside cleanup_quota_test().

Test-Parameters: trivial testlist=sanity-quota
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Change-Id: Ic70f59cdc1181473721e4f87b806b8203857fca8
Reviewed-on: https://review.whamcloud.com/34108
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity-quota.sh

index be395ab..921f67e 100755 (executable)
@@ -386,6 +386,7 @@ cleanup_quota_test() {
        echo "Wait for unlink objects finished..."
        wait_delete_completed
        sync_all_data || true
+       reset_quota_settings
 }
 
 quota_show_check() {
@@ -517,7 +518,6 @@ test_0() {
        test_quota_performance $MB
 
        cleanup_quota_test
-       resetquota -u $TSTUSR
 }
 run_test 0 "Test basic quota performance"
 
@@ -633,10 +633,8 @@ test_1() {
        cleanup_quota_test
 
        USED=$(getquota -p $TSTPRJID global curspace)
-       [ $USED -ne 0 ] && quota_error p $TSTPRJID \
+       [ $USED -eq 0 ] || quota_error p $TSTPRJID \
                "project quota isn't released after deletion"
-
-       resetquota -p $TSTPRJID
 }
 run_test 1 "Block hard limit (normal use and out of quota)"
 
@@ -738,11 +736,9 @@ test_2() {
 
        cleanup_quota_test
        USED=$(getquota -p $TSTPRJID global curinodes)
-       [ $USED -ne 0 ] && quota_error p $TSTPRJID \
+       [ $USED -eq 0 ] || quota_error p $TSTPRJID \
                "project quota isn't released after deletion"
 
-       resetquota -p $TSTPRJID
-
 }
 run_test 2 "File hard limit (normal use and out of quota)"
 
@@ -853,7 +849,6 @@ test_3() {
                error "set user quota failed"
 
        test_block_soft $TESTFILE $GRACE $LIMIT "u"
-       resetquota -u $TSTUSR
 
        echo "Group quota (soft limit:$LIMIT MB  grace:$GRACE seconds)"
        TESTFILE=$DIR/$tdir/$tfile-1
@@ -867,7 +862,6 @@ test_3() {
                error "set group quota failed"
 
        test_block_soft $TESTFILE $GRACE $LIMIT "g"
-       resetquota -g $TSTUSR
 
        if is_project_quota_supported; then
                echo "Project quota (soft limit:$LIMIT MB  grace:$GRACE sec)"
@@ -988,7 +982,6 @@ test_4a() {
        [ $(facet_fstype $SINGLEMDS) = "zfs" ] && GRACE=20
 
        test_file_soft $TESTFILE $LIMIT $GRACE
-       resetquota -u $TSTUSR
 
        echo "Group quota (soft limit:$LIMIT files  grace:$GRACE seconds)"
        # make sure the system is clean
@@ -1002,7 +995,6 @@ test_4a() {
        TESTFILE=$DIR/$tdir/$tfile-1
 
        test_file_soft $TESTFILE $LIMIT $GRACE
-       resetquota -g $TSTUSR
 
        if is_project_quota_supported; then
                echo "Project quota (soft limit:$LIMIT files grace:$GRACE sec)"
@@ -1127,10 +1119,6 @@ test_5() {
        unlinkmany $DIR/$tdir/$tfile-0_ $((ILIMIT + 1)) ||
                error "unlinkmany $DIR/$tdir/$tfile-0_ failed"
        cleanup_quota_test
-
-       resetquota -u $TSTUSR
-       resetquota -g $TSTUSR
-       resetquota -p $TSTPRJID
 }
 run_test 5 "Chown & chgrp successfully even out of block/file quota"
 
@@ -1227,7 +1215,6 @@ test_6() {
        done
 
        cleanup_quota_test
-       resetquota -u $TSTUSR
 }
 run_test 6 "Test dropping acquire request on master"
 
@@ -1300,7 +1287,6 @@ test_7a() {
                quota_error u $TSTUSR "write error, but expect success"
 
        cleanup_quota_test
-       resetquota -u $TSTUSR
 }
 run_test 7a "Quota reintegration (global index)"
 
@@ -1360,7 +1346,6 @@ test_7b() {
        [ $USED -gt $old_used ] || error "limit on $OSTUUID $USED <= $old_used"
 
        cleanup_quota_test
-       resetquota -u $TSTUSR
        $SHOW_QUOTA_USER
 }
 run_test 7b "Quota reintegration (slave index)"
@@ -1413,7 +1398,6 @@ test_7c() {
                quota_error u $TSTUSR "write success, but expect EDQUOT"
 
        cleanup_quota_test
-       resetquota -u $TSTUSR
 }
 run_test 7c "Quota reintegration (restart mds during reintegration)"
 
@@ -1450,8 +1434,6 @@ test_7d(){
                quota_error u $TSTUSR2 "$TSTUSR2 write success, expect EDQUOT"
 
        cleanup_quota_test
-       resetquota -u $TSTUSR
-       resetquota -u $TSTUSR2
 }
 run_test 7d "Quota reintegration (Transfer index in multiple bulks)"
 
@@ -1538,7 +1520,6 @@ test_7e() {
        rmdir $DIR/${tdir}-1 || error "unlink remote dir failed"
 
        cleanup_quota_test
-       resetquota -u $TSTUSR
 }
 run_test 7e "Quota reintegration (inode limits)"
 
@@ -1574,9 +1555,6 @@ test_8() {
 
        is_project_quota_supported && change_project -C $DIR/$tdir
        cleanup_quota_test
-       resetquota -u $TSTUSR
-       resetquota -g $TSTUSR
-       resetquota -p $TSTPRJID
 }
 run_test 8 "Run dbench with quota enabled"
 
@@ -1636,8 +1614,6 @@ test_9() {
        $SHOW_QUOTA_GROUP
 
        cleanup_quota_test
-       resetquota -u $TSTUSR
-       resetquota -g $TSTUSR
 
        $SHOW_QUOTA_USER
        $SHOW_QUOTA_GROUP
@@ -1672,7 +1648,6 @@ test_10() {
                error "write failure, expect success"
 
        cleanup_quota_test
-       resetquota -u $TSTUSR
 }
 run_test 10 "Test quota for root user"
 
@@ -1696,7 +1671,6 @@ test_11() {
        [ $USED -ge 2 ] || error "Used inodes($USED) is less than 2"
 
        cleanup_quota_test
-       resetquota -u $TSTUSR
 }
 run_test 11 "Chown/chgrp ignores quota"
 
@@ -1740,7 +1714,6 @@ test_12a() {
                quota_error a $TSTUSR "rebalancing failed"
 
        cleanup_quota_test
-       resetquota -u $TSTUSR
 }
 run_test 12a "Block quota rebalancing"
 
@@ -1785,7 +1758,6 @@ test_12b() {
        rmdir $DIR/${tdir}-1 || error "unlink remote dir failed"
 
        cleanup_quota_test
-       resetquota -u $TSTUSR
 }
 run_test 12b "Inode quota rebalancing"
 
@@ -1916,7 +1888,6 @@ test_17sub() {
                "Used space(${USED}K) is less than ${BLKS}M"
 
        cleanup_quota_test
-       resetquota -u $TSTUSR
 }
 
 # DQACQ return recoverable error
@@ -1999,7 +1970,6 @@ test_18_sub () {
                        "got ${testfile_size}. Verifying file failed!"
        fi
        cleanup_quota_test
-       resetquota -u $TSTUSR
 }
 
 # test when mds does failover, the ost still could work well
@@ -2052,7 +2022,6 @@ test_19() {
        $SHOW_QUOTA_USER
 
        cleanup_quota_test
-       resetquota -u $TSTUSR
 }
 run_test 19 "Updating admin limits doesn't zero operational limits(b14790)"
 
@@ -2169,9 +2138,6 @@ test_21() {
        echo "(dd_pid=$DDPID2, time=$count)successful"
 
        cleanup_quota_test
-       resetquota -u $TSTUSR
-       resetquota -g $TSTUSR
-       resetquota -p $TSTPRJID
 }
 run_test 21 "Setquota while writing & deleting (b16053)"
 
@@ -2258,7 +2224,6 @@ test_23_sub() {
                ($SHOW_QUOTA_USER; \
                quota_error u $TSTUSR "quota isn't released")
        $SHOW_QUOTA_USER
-       resetquota -u $TSTUSR
 }
 
 test_23() {
@@ -2304,7 +2269,6 @@ test_24() {
        $SHOW_QUOTA_USER | grep '*' || error "no matching *"
 
        cleanup_quota_test
-       resetquota -u $TSTUSR
 }
 run_test 24 "lfs draws an asterix when limit is reached (b16646)"
 
@@ -2414,7 +2378,6 @@ test_30() {
                error "grace times were reset"
        # cleanup
        cleanup_quota_test
-       resetquota -u $TSTUSR
        $LFS setquota -t -u --block-grace $MAX_DQ_TIME --inode-grace \
                $MAX_IQ_TIME $DIR || error "restore grace time failed"
 }
@@ -3068,7 +3031,6 @@ test_55() {
 
        $LFS quota -v -g $TSTUSR2 $DIR
 
-       resetquota -g $TSTUSR2
        cleanup_quota_test
 }
 run_test 55 "Chgrp should be affected by group quota"
@@ -3158,7 +3120,6 @@ test_60() {
                error "root user should succeed"
 
        cleanup_quota_test
-       resetquota -g $TSTUSR
 }
 run_test 60 "Test quota for root with setgid"