Whamcloud - gitweb
LU-17171 test: improve sanity-quota test_41 91/52591/5
authorLai Siyao <lai.siyao@whamcloud.com>
Sat, 30 Sep 2023 20:10:54 +0000 (16:10 -0400)
committerOleg Drokin <green@whamcloud.com>
Fri, 3 Nov 2023 04:05:19 +0000 (04:05 +0000)
On zfs backend, df result of project quota may print be a slightly
larger block used than quota result because the former is calcuated
in filesystem block size which is 4K.

Update sanity-quota test_41 to make it more robust.

Test-Parameters: trivial testlist=sanity-quota fstype=zfs
Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
Change-Id: Ide51d9aaeb8907eb77acc30fa4fc76dcc16e8de0
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52591
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
lustre/tests/sanity-quota.sh

index c2a903a..c643f09 100755 (executable)
@@ -3882,14 +3882,21 @@ test_41() {
        df -kP $dir; df -iP $dir
        local bused=$(getquota -p $projid global curspace)
        local iused=$(getquota -p $projid global curinodes)
-       # note trailing space to match double printf from awk
-       local expected="$blimit $bused $ilimit $iused "
+       local expected="$ilimit$iused"
 
        wait_update $HOSTNAME \
-               "{ df -kP $dir; df -iP $dir; } |
-                awk '/$FSNAME/ { printf \\\"%d %d \\\", \\\$2,\\\$3 }'" \
+               "df -iP $dir | awk \\\"/$FSNAME/\\\"'{print \\\$2 \\\$3}'" \
                "$expected" ||
                error "failed to get correct statfs for project quota"
+
+       expected=$(df -kP $dir | awk "/$FSNAME/"' {print $2}')
+       (( expected == blimit )) ||
+               error "blimit mismatch: $expected != $blimit"
+
+       # zfs block size is 4K, while quota is printed in 1K, df result may be
+       # larger than quota result, but it's no more than 3K
+       expected=$(df -kP $dir | awk "/$FSNAME/"' {print $3}')
+       (( expected - bused < 4)) || error "bused mismatch: $expected != $bused"
 }
 run_test 41 "df should return projid-specific values"