mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	ZTS: Polish online_offline tests
- Kill workload first for faster cleanup.
 - Use `zpool wait` for resilver instead of `sleep`.
 - Remove irrelevant workload from `online_offline_003_neg`.
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by:	Alexander Motin <mav@FreeBSD.org>
Sponsored by:	iXsystems, Inc.
Closes: #17259
(cherry picked from commit cb49e7701f)
			
			
This commit is contained in:
		
							parent
							
								
									95df01020d
								
							
						
					
					
						commit
						03ac770008
					
				| @ -50,16 +50,17 @@ DISKLIST=$(get_disklist $TESTPOOL) | ||||
| 
 | ||||
| function cleanup | ||||
| { | ||||
| 	kill $killpid >/dev/null 2>&1 | ||||
| 
 | ||||
| 	# | ||||
| 	# Ensure we don't leave disks in the offline state | ||||
| 	# | ||||
| 	for disk in $DISKLIST; do | ||||
| 		log_must zpool online $TESTPOOL $disk | ||||
| 		log_must check_state $TESTPOOL $disk "online" | ||||
| 
 | ||||
| 	done | ||||
| 	log_must zpool wait -t resilver $TESTPOOL | ||||
| 
 | ||||
| 	kill $killpid >/dev/null 2>&1 | ||||
| 	[[ -e $TESTDIR ]] && log_must rm -rf $TESTDIR/* | ||||
| } | ||||
| 
 | ||||
| @ -77,8 +78,7 @@ for disk in $DISKLIST; do | ||||
| 	log_must zpool online $TESTPOOL $disk | ||||
| 	log_must check_state $TESTPOOL $disk "online" | ||||
| 
 | ||||
| 	# Delay for resilver to complete | ||||
| 	sleep 3 | ||||
| 	log_must zpool wait -t resilver $TESTPOOL | ||||
| done | ||||
| 
 | ||||
| log_must kill $killpid | ||||
|  | ||||
| @ -51,6 +51,8 @@ DISKLIST=$(get_disklist $TESTPOOL) | ||||
| 
 | ||||
| function cleanup | ||||
| { | ||||
| 	kill $killpid >/dev/null 2>&1 | ||||
| 
 | ||||
| 	# | ||||
| 	# Ensure we don't leave disks in the offline state | ||||
| 	# | ||||
| @ -58,8 +60,8 @@ function cleanup | ||||
| 		log_must zpool online $TESTPOOL $disk | ||||
| 		log_must check_state $TESTPOOL $disk "online" | ||||
| 	done | ||||
| 	log_must zpool wait -t resilver $TESTPOOL | ||||
| 
 | ||||
| 	kill $killpid >/dev/null 2>&1 | ||||
| 	[[ -e $TESTDIR ]] && log_must rm -rf $TESTDIR/* | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -49,7 +49,6 @@ function cleanup | ||||
| 		destroy_pool $TESTPOOL1 | ||||
| 	fi | ||||
| 
 | ||||
| 	kill $killpid >/dev/null 2>&1 | ||||
| 	[[ -e $TESTDIR ]] && log_must rm -rf $TESTDIR/* | ||||
| } | ||||
| 
 | ||||
| @ -59,7 +58,7 @@ log_onexit cleanup | ||||
| 
 | ||||
| specials_list="" | ||||
| for i in 0 1 2; do | ||||
| 	mkfile $MINVDEVSIZE $TESTDIR/$TESTFILE1.$i | ||||
| 	log_must mkfile $MINVDEVSIZE $TESTDIR/$TESTFILE1.$i | ||||
| 	specials_list="$specials_list $TESTDIR/$TESTFILE1.$i" | ||||
| done | ||||
| disk=($specials_list) | ||||
| @ -68,15 +67,9 @@ create_pool $TESTPOOL1 $specials_list | ||||
| log_must zfs create $TESTPOOL1/$TESTFS1 | ||||
| log_must zfs set mountpoint=$TESTDIR1 $TESTPOOL1/$TESTFS1 | ||||
| 
 | ||||
| file_trunc -f $((64 * 1024 * 1024)) -b 8192 -c 0 -r $TESTDIR/$TESTFILE1 & | ||||
| typeset killpid="$! " | ||||
| 
 | ||||
| for i in 0 1 2; do | ||||
| 	log_mustnot zpool offline $TESTPOOL1 ${disk[$i]} | ||||
| 	check_state $TESTPOOL1 ${disk[$i]} "online" | ||||
| done | ||||
| 
 | ||||
| log_must kill $killpid | ||||
| sync_all_pools | ||||
| 
 | ||||
| log_pass | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Alexander Motin
						Alexander Motin