git: be092bcde96b - main - Fix the zfsd_autoreplace_001_neg test

From: Alan Somers <asomers_at_FreeBSD.org>
Date: Wed, 05 Jul 2023 22:39:11 UTC
The branch main has been updated by asomers:

URL: https://cgit.FreeBSD.org/src/commit/?id=be092bcde96bdcfde9013d60e442cca023bfbd1b

commit be092bcde96bdcfde9013d60e442cca023bfbd1b
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2023-07-05 22:37:39 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2023-07-05 22:38:49 +0000

    Fix the zfsd_autoreplace_001_neg test
    
    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
---
 tests/sys/cddl/zfs/tests/zfsd/zfsd_autoreplace_001_neg.ksh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/sys/cddl/zfs/tests/zfsd/zfsd_autoreplace_001_neg.ksh b/tests/sys/cddl/zfs/tests/zfsd/zfsd_autoreplace_001_neg.ksh
index 9e811d06f94d..7fe855789f28 100644
--- a/tests/sys/cddl/zfs/tests/zfsd/zfsd_autoreplace_001_neg.ksh
+++ b/tests/sys/cddl/zfs/tests/zfsd/zfsd_autoreplace_001_neg.ksh
@@ -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:
@@ -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
 }
@@ -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"