Fix change_pg_count test (statistic reporting may take some time)

nfs-proxy-old
Vitaliy Filippov 12 months ago
parent 83146fa3e2
commit 0eb929f1ba
  1. 11
      tests/test_change_pg_count.sh

@ -78,7 +78,16 @@ try_change()
fi
# Check that no objects are lost !
nobj=`$ETCDCTL get --prefix '/vitastor/pg/stats' --print-value-only | jq -s '[ .[].object_count ] | reduce .[] as $num (0; .+$num)'`
# But note that reporting this information may take up to <etcd_report_interval+1> seconds
nobj=0
waittime=0
while [[ $nobj -ne $NOBJ && $waittime -lt 7 ]]; do
nobj=`$ETCDCTL get --prefix '/vitastor/pg/stats' --print-value-only | jq -s '[ .[].object_count ] | reduce .[] as $num (0; .+$num)'`
if [[ $nobj -ne $NOBJ ]]; then
waittime=$((waittime+1))
sleep 1
fi
done
if [ "$nobj" -ne $NOBJ ]; then
format_error "Data lost after changing PG count to $n: $NOBJ objects expected, but got $nobj"
fi

Loading…
Cancel
Save