]> git.proxmox.com Git - mirror_zfs.git/commitdiff
tests/quota: consistently clear quota property between tests
authorRob Norris <rob.norris@klarasystems.com>
Tue, 16 Apr 2024 04:56:35 +0000 (14:56 +1000)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 19 Apr 2024 23:06:56 +0000 (16:06 -0700)
When run in isolation, quota_005_pos would fail in cleanup because it
would attempt restore the previous quota, which was 0, and so get an
error (because you can't set quota to '0', you have to use 'none').

It worked as part of the quota tag set because the previous tests did
not clean up their quota, so there was always a non-zero quota to return
to.

This adds a simple quota reset function, and has all quota tests run it
at cleanup. For the ones that weren't cleaning up, they now do, and for
quota_005_pos, which was trying to do the right thing, it now just
resets it.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #16097

tests/zfs-tests/tests/functional/quota/quota.kshlib
tests/zfs-tests/tests/functional/quota/quota_001_pos.ksh
tests/zfs-tests/tests/functional/quota/quota_002_pos.ksh
tests/zfs-tests/tests/functional/quota/quota_003_pos.ksh
tests/zfs-tests/tests/functional/quota/quota_004_pos.ksh
tests/zfs-tests/tests/functional/quota/quota_005_pos.ksh
tests/zfs-tests/tests/functional/quota/quota_006_neg.ksh

index 5083415c895628930a8dd29aa32e8ca34bde5c49..b4cfde020f3f721e0be41d86951cd024308a76ac 100644 (file)
@@ -95,3 +95,10 @@ function exceed_quota
            log_fail "Returned error code: $zret. Expected: $EDQUOT."
        return 0
 }
+
+function reset_quota
+{
+       typeset FILESYSTEM="$1"
+
+       log_must zfs set quota=none $FILESYSTEM
+}
index d124cb26ae986dbed6b854557522ba4703024f03..f01008a46bb12e4cedb6158cb203c1bd62884d75 100755 (executable)
@@ -64,6 +64,8 @@ function cleanup
        #
        wait_freeing $TESTPOOL
        sync_pool $TESTPOOL
+
+       reset_quota $TESTPOOL/$TESTFS
 }
 
 log_onexit cleanup
index 3af005e874e9f046ed3fa0b19771ea87749a9b96..bea2a5a6869182872d2505b37980705eb3bbc801 100755 (executable)
@@ -64,6 +64,8 @@ function cleanup
 
        wait_freeing $TESTPOOL
        sync_pool $TESTPOOL
+
+       reset_quota $TESTPOOL/$TESTFS
 }
 
 log_onexit cleanup
index de265813d55b8eec892c257d5e23a81103c60829..33f6421131fc82654d92d517abd6921a38cf8268 100755 (executable)
@@ -67,6 +67,8 @@ function cleanup
        #
        wait_freeing $TESTPOOL
        sync_pool $TESTPOOL
+
+       reset_quota $TESTPOOL/$TESTCTR/$TESTFS1
 }
 
 log_onexit cleanup
index 8f20b533da684e8a0bf655afdd07fc770850b1b4..682d09f080a42e6c72cec544c9d743a219d396e0 100755 (executable)
@@ -65,6 +65,8 @@ function cleanup
 
        wait_freeing $TESTPOOL
        sync_pool $TESTPOOL
+
+       reset_quota $TESTPOOL/$TESTCTR/$TESTFS1
 }
 
 log_onexit cleanup
index fb3d97f486de3840fea4dc34cde0bf0d4b3eee93..9c4db81ca27068bd0a048f9d61c440bc4ac6c1a4 100755 (executable)
@@ -50,7 +50,7 @@ function cleanup
 {
        datasetexists $fs_child && destroy_dataset $fs_child
 
-       log_must zfs set quota=$quota_val $fs
+       reset_quota $fs
 }
 
 log_onexit cleanup
index 12105162c5b564c05c16254d948565b902410aeb..111d771188e3602494220c5db6e904604d370998 100755 (executable)
@@ -50,7 +50,7 @@ log_assert "Verify cannot set quota lower than the space currently in use"
 
 function cleanup
 {
-       log_must zfs set quota=none $TESTPOOL/$TESTFS
+       reset_quota $TESTPOOL/$TESTFS
 }
 
 log_onexit cleanup