Fix node folding in case of empty rules (pool with size 1), add a test
This commit is contained in:
@@ -87,6 +87,22 @@ wait_etcd()
|
||||
done
|
||||
}
|
||||
|
||||
wait_condition()
|
||||
{
|
||||
sec=$1
|
||||
check=$2
|
||||
proc=$3
|
||||
i=0
|
||||
while [[ $i -lt $sec ]]; do
|
||||
eval "$check" && break
|
||||
if [ $i -eq $sec ]; then
|
||||
format_error "$proc couldn't finish in $sec seconds"
|
||||
fi
|
||||
sleep 1
|
||||
i=$((i+1))
|
||||
done
|
||||
}
|
||||
|
||||
if [[ -n "$ANTIETCD" ]]; then
|
||||
ETCDCTL="node mon/node_modules/.bin/anticli -e $ETCD_URL"
|
||||
MON_PARAMS="--use_antietcd 1 --antietcd_data_dir ./testdata --antietcd_persist_interval 500 $MON_PARAMS"
|
||||
|
||||
@@ -127,22 +127,6 @@ try_reweight()
|
||||
sleep 3
|
||||
}
|
||||
|
||||
wait_condition()
|
||||
{
|
||||
sec=$1
|
||||
check=$2
|
||||
proc=$3
|
||||
i=0
|
||||
while [[ $i -lt $sec ]]; do
|
||||
eval "$check" && break
|
||||
if [ $i -eq $sec ]; then
|
||||
format_error "$proc couldn't finish in $sec seconds"
|
||||
fi
|
||||
sleep 1
|
||||
i=$((i+1))
|
||||
done
|
||||
}
|
||||
|
||||
wait_finish_rebalance()
|
||||
{
|
||||
sec=$1
|
||||
|
||||
@@ -31,4 +31,8 @@ sleep 2
|
||||
$ETCDCTL get --prefix /vitastor/pg/config --print-value-only | \
|
||||
jq -s -e '([ .[0].items["1"] | .[].osd_set | map_values(. | tonumber) | select((.[0] <= 4) != (.[1] <= 4)) ] | length) == 4'
|
||||
|
||||
# test pool with size 1
|
||||
build/src/cmd/vitastor-cli --etcd_address $ETCD_URL create-pool size1pool -s 1 -n 1 --force
|
||||
wait_condition 10 "$ETCDCTL get --prefix /vitastor/pg/config --print-value-only | jq -s -e '.[0].items["'"'"2"'"'"]'"
|
||||
|
||||
format_green OK
|
||||
|
||||
Reference in New Issue
Block a user