Skip to content
This repository has been archived by the owner on Nov 7, 2019. It is now read-only.

Commit

Permalink
11066 zfs clean_mirror tests should scrub between tests
Browse files Browse the repository at this point in the history
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Approved by: Gordon Ross <gwr@nexenta.com>
  • Loading branch information
KodyKantor authored and gwr committed May 24, 2019
1 parent f006f88 commit 7811b02
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Expand Up @@ -27,6 +27,7 @@
#
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
# Copyright (c) 2017 Datto Inc.
# Copyright 2019 Joyent, Inc.
#

. $STF_SUITE/include/libtest.shlib
Expand All @@ -48,6 +49,8 @@ function overwrite_verify_mirror
set -A cksums
set -A newcksums

scrub_pool # Make sure we have a clean pool before starting the test.

while (( atfile < FILE_COUNT )); do
files[$atfile]=$TESTDIR/file.$atfile
log_must file_write -o create -f $TESTDIR/file.$atfile \
Expand Down Expand Up @@ -86,3 +89,20 @@ function overwrite_verify_mirror

sync_pool $TESTPOOL
}

# Scrub the pool and wait for completion.
function scrub_pool
{
typeset pool=$TESTPOOL
log_note "Scrubbing $TESTPOOL"

# Flush all the pool data.
log_must zpool scrub $pool

while ! is_pool_scrubbed $pool; do
if is_pool_resilvered $pool ; then
log_fail "$pool should not have been resilvered"
fi
log_must sleep 2
done
}
Expand Up @@ -27,6 +27,7 @@

#
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
# Copyright 2019 Joyent, Inc.
#

. $STF_SUITE/tests/functional/clean_mirror/default.cfg
Expand All @@ -46,4 +47,8 @@ else
log_must cleanup_devices $MIRROR_PRIMARY $MIRROR_SECONDARY
fi

if [[ -d $TESTDIR ]]; then
log_must rmdir $TESTDIR
fi

log_pass

0 comments on commit 7811b02

Please sign in to comment.