Skip to content

ZTS: Fix two bugs in the zpool dry run tests #17198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,17 @@ for (( i=0; i < ${#tests[@]}; i+=1 )); do

log_must eval zpool create "$TESTPOOL" $tree
log_must poolexists "$TESTPOOL"
typeset out="$(log_must eval "zpool add -n '$TESTPOOL' $add" | \
sed /^SUCCESS/d)"

typeset out
out="$(eval zpool add -n '$TESTPOOL' $add)"
if [[ $? -ne 0 ]]; then
log_fail eval "zpool add -n '$TESTPOOL' $add"
fi
if [[ "$out" != "$want" ]]; then
log_fail "Got:\n" "$out" "\nbut expected:\n" "$want"
log_note "Got:"
log_note "$out"
log_note "but expected:"
log_note "$want"
log_fail "Dry run does not display config correctly"
fi
log_must destroy_pool "$TESTPOOL"
done
Expand All @@ -170,7 +176,11 @@ log_must eval "zpool create '$TESTPOOL' '${dev[0]}' log '${dev[1]}' \

# Create a hole vdev.
log_must eval "zpool remove '$TESTPOOL' '${dev[1]}'"
log_mustnot eval "zpool add -n '$TESTPOOL' '${dev[1]}' | \
grep -qE '[[:space:]]+hole'"
typeset out
out="$(eval zpool add -n '$TESTPOOL' '${dev[1]}')"
if [[ $? -ne 0 ]]; then
log_fail eval "zpool add -n '$TESTPOOL' '${dev[1]}'"
fi
log_mustnot grep -qE '[[:space:]]+hole' <<<"$out"

log_pass "'zpool add -n <pool> <vdev> ...' displays config correctly."
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,17 @@ done
for (( i=0; i < ${#tests[@]}; i+=1 )); do
tree="${tests[$i].tree}"
want="${tests[$i].want}"

typeset out="$(log_must eval "zpool create -n '$TESTPOOL' $tree" | \
sed /^SUCCESS/d)"

typeset out
out="$(eval zpool create -n '$TESTPOOL' $tree)"
if [[ $? -ne 0 ]]; then
log_fail eval "zpool create -n '$TESTPOOL' $tree"
fi
if [[ "$out" != "$want" ]]; then
log_fail "Got:\n" "$out" "\nbut expected:\n" "$want"
log_note "Got:"
log_note "$out"
log_note "but expected:"
log_note "$want"
log_fail "Dry run does not display config correctly"
fi
done

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,17 @@ for (( i=0; i < ${#tests[@]}; i+=1 )); do

log_must eval zpool create "$TESTPOOL" $tree
log_must poolexists "$TESTPOOL"
typeset out="$(log_must eval "zpool split -n \
'$TESTPOOL' '$NEWPOOL' $devs" | sed /^SUCCESS/d)"

typeset out
out="$(eval zpool split -n '$TESTPOOL' '$NEWPOOL' $devs)"
if [[ $? -ne 0 ]]; then
log_fail eval "zpool split -n '$TESTPOOL' '$NEWPOOL' $devs"
fi
if [[ "$out" != "$want" ]]; then
log_fail "Got:\n" "$out" "\nbut expected:\n" "$want"
log_note "Got:"
log_note "$out"
log_note "but expected:"
log_note "$want"
log_fail "Dry run does not display config correctly"
fi
log_must destroy_pool "$TESTPOOL"
done
Expand Down
Loading