diff --git a/tests/test_change_pg_count.sh b/tests/test_change_pg_count.sh index 008f0c4f..2928cb48 100755 --- a/tests/test_change_pg_count.sh +++ b/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 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