aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2021-04-03 08:33:22 -0700
committerGitHub <[email protected]>2021-04-03 08:33:22 -0700
commitec580225d2b2fb78ea9e12d0b08a185fbb50c7a6 (patch)
treef68930e49ce42caa01b99c3f94e0f27e482ba515 /tests
parentbf169e9f15efbc343b931f20cfad5d2b59c8a821 (diff)
ZTS: pool_checkpoint improvements
The pool_checkpoint tests may incorrectly fail because several of them invoke zdb for an imported pool. In this scenario it's not unexpected for zdb to fail if the pool is modified. To resolve this these zdb checks are now done after the pool has been exported. Additionally, the default cleanup functions assumed the pool would be imported when they were run. If this was not the case they're exit early and fail to cleanup all of the test state causing subsequent tests to fail. Add a check to only destroy the pool when it is imported. Reviewed-by: John Kennedy <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: George Melikov <[email protected]> Reviewed-by: Serapheim Dimitropoulos <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #11832
Diffstat (limited to 'tests')
-rwxr-xr-xtests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_big_rewind.ksh3
-rwxr-xr-xtests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_capacity.ksh7
-rwxr-xr-xtests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_discard_busy.ksh3
-rw-r--r--tests/zfs-tests/tests/functional/pool_checkpoint/pool_checkpoint.kshlib9
4 files changed, 15 insertions, 7 deletions
diff --git a/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_big_rewind.ksh b/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_big_rewind.ksh
index f915d2ad4..7e523ef90 100755
--- a/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_big_rewind.ksh
+++ b/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_big_rewind.ksh
@@ -52,6 +52,7 @@ fragment_after_checkpoint_and_verify
log_must zpool export $NESTEDPOOL
log_must zpool import -d $FILEDISKDIR --rewind-to-checkpoint $NESTEDPOOL
-log_must zdb $NESTEDPOOL
+log_must zpool export $NESTEDPOOL
+log_must zdb -e -p $FILEDISKDIR $NESTEDPOOL
log_pass "Rewind to checkpoint on a stressed pool."
diff --git a/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_capacity.ksh b/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_capacity.ksh
index 15afc4adf..b6d34307b 100755
--- a/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_capacity.ksh
+++ b/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_capacity.ksh
@@ -80,13 +80,14 @@ log_mustnot dd if=/dev/urandom of=$NESTEDFS0FILE bs=1M count=300
#
log_must zpool list $NESTEDPOOL
-log_must zdb -kc $NESTEDPOOL
-
log_must zpool export $NESTEDPOOL
+log_must zdb -e -p $FILEDISKDIR -kc $NESTEDPOOL
+
log_must zpool import -d $FILEDISKDIR --rewind-to-checkpoint $NESTEDPOOL
log_must [ "$(head -c 100 $NESTEDFS0FILE)" = "$FILE0INTRO" ]
-log_must zdb $NESTEDPOOL
+log_must zpool export $NESTEDPOOL
+log_must zdb -e -p $FILEDISKDIR $NESTEDPOOL
log_pass "Do not reuse checkpointed space at low capacity."
diff --git a/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_discard_busy.ksh b/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_discard_busy.ksh
index ae099ff27..f970935f5 100755
--- a/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_discard_busy.ksh
+++ b/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_discard_busy.ksh
@@ -104,7 +104,8 @@ set_tunable64 SPA_DISCARD_MEMORY_LIMIT 16777216
nested_wait_discard_finish
-log_must zdb $NESTEDPOOL
+log_must zpool export $NESTEDPOOL
+log_must zdb -e -p $FILEDISKDIR $NESTEDPOOL
log_pass "Can export/import but not rewind/checkpoint/discard or " \
"change pool's config while discarding."
diff --git a/tests/zfs-tests/tests/functional/pool_checkpoint/pool_checkpoint.kshlib b/tests/zfs-tests/tests/functional/pool_checkpoint/pool_checkpoint.kshlib
index ea6c03e9d..bb8bab6cd 100644
--- a/tests/zfs-tests/tests/functional/pool_checkpoint/pool_checkpoint.kshlib
+++ b/tests/zfs-tests/tests/functional/pool_checkpoint/pool_checkpoint.kshlib
@@ -154,13 +154,18 @@ function setup_nested_pools
function cleanup_nested_pool
{
- log_must zpool destroy $NESTEDPOOL
+ if poolexists $NESTEDPOOL; then
+ log_must zpool destroy $NESTEDPOOL
+ fi
+
log_must rm -f $FILEDISKS
}
function cleanup_test_pool
{
- log_must zpool destroy $TESTPOOL
+ if poolexists $TESTPOOL; then
+ log_must zpool destroy $TESTPOOL
+ fi
#
# We always clear the labels of all disks