Skip to content

Commit cfa7211

Browse files
committed
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
1 parent cc86c26 commit cfa7211

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_big_rewind.ksh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ fragment_after_checkpoint_and_verify
5252
log_must zpool export $NESTEDPOOL
5353
log_must zpool import -d $FILEDISKDIR --rewind-to-checkpoint $NESTEDPOOL
5454

55-
log_must zdb $NESTEDPOOL
55+
log_must zpool export $NESTEDPOOL
56+
log_must zdb -e -p $FILEDISKDIR $NESTEDPOOL
5657

5758
log_pass "Rewind to checkpoint on a stressed pool."

tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_capacity.ksh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,14 @@ log_mustnot dd if=/dev/urandom of=$NESTEDFS0FILE bs=1M count=300
8080
#
8181
log_must zpool list $NESTEDPOOL
8282

83-
log_must zdb -kc $NESTEDPOOL
84-
8583
log_must zpool export $NESTEDPOOL
84+
log_must zdb -e -p $FILEDISKDIR -kc $NESTEDPOOL
85+
8686
log_must zpool import -d $FILEDISKDIR --rewind-to-checkpoint $NESTEDPOOL
8787

8888
log_must [ "$(head -c 100 $NESTEDFS0FILE)" = "$FILE0INTRO" ]
8989

90-
log_must zdb $NESTEDPOOL
90+
log_must zpool export $NESTEDPOOL
91+
log_must zdb -e -p $FILEDISKDIR $NESTEDPOOL
9192

9293
log_pass "Do not reuse checkpointed space at low capacity."

tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_discard_busy.ksh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ set_tunable64 SPA_DISCARD_MEMORY_LIMIT 16777216
104104

105105
nested_wait_discard_finish
106106

107-
log_must zdb $NESTEDPOOL
107+
log_must zpool export $NESTEDPOOL
108+
log_must zdb -e -p $FILEDISKDIR $NESTEDPOOL
108109

109110
log_pass "Can export/import but not rewind/checkpoint/discard or " \
110111
"change pool's config while discarding."

tests/zfs-tests/tests/functional/pool_checkpoint/pool_checkpoint.kshlib

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,18 @@ function setup_nested_pools
154154

155155
function cleanup_nested_pool
156156
{
157-
log_must zpool destroy $NESTEDPOOL
157+
if poolexists $NESTEDPOOL; then
158+
log_must zpool destroy $NESTEDPOOL
159+
fi
160+
158161
log_must rm -f $FILEDISKS
159162
}
160163

161164
function cleanup_test_pool
162165
{
163-
log_must zpool destroy $TESTPOOL
166+
if poolexists $TESTPOOL; then
167+
log_must zpool destroy $TESTPOOL
168+
fi
164169

165170
#
166171
# We always clear the labels of all disks

0 commit comments

Comments
 (0)