aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zfs-tests/include
diff options
context:
space:
mode:
authorJohn Wren Kennedy <[email protected]>2016-08-17 15:15:27 -0600
committerBrian Behlendorf <[email protected]>2018-06-04 14:55:02 -0700
commitab44e511e2546567a296a88e71ed2056372fd5a4 (patch)
tree866d0a8097b872edfa119612b44e4589627c3fea /tests/zfs-tests/include
parent8a393be353c3bfffbfbe0f4d2bc57210b658dcde (diff)
OpenZFS 9245 - zfs-test failures: slog_013_pos and slog_014_pos
Test 13 would fail because of attempts to zpool destroy -f a pool that was still busy. Changed those calls to destroy_pool which does a retry loop, and the problem is no longer reproducible. Also removed some non functional code in the test which is why it was originally commented out by placing it after the call to log_pass. Test 14 would fail because sometimes the check for a degraded pool would complete before the pool had changed state. Changed the logic to check in a loop with a timeout and the problem is no longer reproducible. Authored by: John Wren Kennedy <[email protected]> Reviewed by: Matt Ahrens <[email protected]> Reviewed by: Chris Williamson <[email protected]> Reviewed by: Yuri Pankov <[email protected]> Reviewed-by: George Melikov <[email protected]> Approved by: Dan McDonald <[email protected]> Ported-by: Brian Behlendorf <[email protected]> Porting Notes: * Re-enabled slog_013_pos.ksh OpenZFS-issue: https://illumos.org/issues/9245 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/8f323b5 Closes #7585
Diffstat (limited to 'tests/zfs-tests/include')
-rw-r--r--tests/zfs-tests/include/libtest.shlib19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib
index e8def35f8..53914d3d0 100644
--- a/tests/zfs-tests/include/libtest.shlib
+++ b/tests/zfs-tests/include/libtest.shlib
@@ -2152,6 +2152,25 @@ function is_pool_removed #pool
return $?
}
+function wait_for_degraded
+{
+ typeset pool=$1
+ typeset timeout=${2:-30}
+ typeset t0=$SECONDS
+
+ while :; do
+ [[ $(get_pool_prop health $pool) == "DEGRADED" ]] && break
+ log_note "$pool is not yet degraded."
+ sleep 1
+ if ((SECONDS - t0 > $timeout)); then
+ log_note "$pool not degraded after $timeout seconds."
+ return 1
+ fi
+ done
+
+ return 0
+}
+
#
# Use create_pool()/destroy_pool() to clean up the information in
# in the given disk to avoid slice overlapping.