Skip to content

Commit

Permalink
Fix the zfsd_autoreplace_001_neg test
Browse files Browse the repository at this point in the history
It only ever worked by accident.
* Actually set autoreplace=off as stated in the description
* Wait for the removed device to disappear from the pool before
  proceeding.
* In the assertion, verify that the new disk does not get added, as
  described in the description.

MFC after:	2 weeks
Sponsored by:	Axcient
  • Loading branch information
asomers committed Jul 5, 2023
1 parent 0724cf3 commit be092bc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/sys/cddl/zfs/tests/zfsd/zfsd_autoreplace_001_neg.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
# ID: zfsd_autoreplace_001_neg
#
# DESCRIPTION:
# In a pool without the autoreplace property unset, a vdev will not be
# In a pool without the autoreplace property set, a vdev will not be
# replaced by physical path
#
# STRATEGY:
Expand All @@ -64,7 +64,7 @@ function verify_assertion
{
# 9. Verify that it does not get added to the pool
for ((timeout=0; timeout<4; timeout=$timeout+1)); do
log_mustnot check_state $TESTPOOL $REMOVAL_DISK "ONLINE"
log_mustnot check_state $TESTPOOL $NEW_DISK "ONLINE"
$SLEEP 5
done
}
Expand All @@ -83,9 +83,10 @@ log_must create_gnops $OTHER_DISKS
for keyword in "${MY_KEYWORDS[@]}" ; do
log_must create_gnop $REMOVAL_DISK $PHYSPATH
log_must create_pool $TESTPOOL $keyword $ALLNOPS
log_must $ZPOOL set autoreplace=on $TESTPOOL
log_must $ZPOOL set autoreplace=off $TESTPOOL

log_must destroy_gnop $REMOVAL_DISK
log_must wait_for_pool_removal 20
log_must create_gnop $NEW_DISK $PHYSPATH
verify_assertion
destroy_pool "$TESTPOOL"
Expand Down

0 comments on commit be092bc

Please sign in to comment.