tests: fix rebalance_completed

This was causing spurious faiures in bug-884455.t and possibly
elsewhere.

Change-Id: Iad6b7515ca0c7c485300f79dcd2477efc76877f8
BUG: 1163543
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/9994
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
This commit is contained in:
Jeff Darcy 2015-03-25 09:21:06 -04:00 committed by Shyamsundar Ranganathan
parent c54e546040
commit 02c0457901
3 changed files with 7 additions and 21 deletions

View File

@ -155,14 +155,7 @@ TEST $CLI volume add-brick $V0 $H0:$B0/brick{3,4}
TEST $CLI volume rebalance $V0 start;
## Wait for rebalance
while true; do
rebalance_completed
if [ $? -eq 1 ]; then
sleep 1;
else
break;
fi
done
EXPECT_WITHIN $REBALANCE_TIMEOUT "0" rebalance_completed
## <Try creating data beyond limit>
## --------------------------------

View File

@ -76,7 +76,11 @@ function rebalance_completed()
fi
echo $val
return $val
# Do not *return* the value here. If it's non-zero, that will cause
# EXPECT_WITHIN (e.g. in bug-884455.t) to return prematurely, leading to
# a spurious test failure. Nothing else checks the return value anyway
# (they all check the output) so there's no need for it to be non-zero
# just because grep didn't find what we want.
}
function remove_brick_completed()

View File

@ -22,17 +22,6 @@ count_files () {
echo $found
}
wait_for_rebalance () {
while true; do
rebalance_completed
if [ $? -eq 1 ]; then
sleep 1
else
break
fi
done
}
get_xattr () {
cmd="getfattr --absolute-names --only-values -n trusted.glusterfs.dht"
$cmd $1 | od -tx1 -An | tr -d ' '
@ -77,7 +66,7 @@ TEST $CLI volume set $V0 cluster.weighted-rebalance off
# Rebalance again and check that the distribution is even again.
TEST $CLI volume rebalance $V0 start force
TEST wait_for_rebalance
EXPECT_WITHIN $REBALANCE_TIMEOUT "0" rebalance_completed
nfiles=$(count_files ${B0}/${V0}2)
#echo $nfiles $(get_xattr ${B0}/${V0}1) $(get_xattr ${B0}/${V0}2) 3>&2 2>&1 1>&3 3>&-
TEST [ $nfiles -le 580 ]