Skip to content

Commit 655deda

Browse files
kvapsclaude
andcommitted
test(e2e): tolerate DRBD metadata overhead in resize comparison
DRBD reserves ~44 KiB at the end of the lower disk for its internal metadata, so /dev/drbdN's reported size after resize is requested minus that overhead. Allow 128 KiB slack in the size comparison (generous for any future DRBD metadata growth). Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
1 parent aab68a1 commit 655deda

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

tests/e2e/resize-luks.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,19 @@ rest_put "/v1/resource-definitions/${RD}/volume-definitions/0" \
6767
"{\"size_kib\":${SIZE_GROWN_KIB}}"
6868

6969
echo ">> wait 60s for satellite resize chain"
70+
TOLERANCE_KIB=128
7071
deadline=$(( $(date +%s) + 60 ))
7172
while (( $(date +%s) < deadline )); do
7273
cur_kib=$(on_node "$N1" bash -c "blockdev --getsize64 ${DEV}" 2>/dev/null || true)
7374
cur_kib=$(( ${cur_kib:-0} / 1024 ))
74-
if (( cur_kib >= SIZE_GROWN_KIB )); then
75+
if (( cur_kib + TOLERANCE_KIB >= SIZE_GROWN_KIB )); then
7576
break
7677
fi
7778
sleep 2
7879
done
7980

80-
if (( cur_kib < SIZE_GROWN_KIB )); then
81-
echo "FAIL: device size $cur_kib < $SIZE_GROWN_KIB after 60s"
81+
if (( cur_kib + TOLERANCE_KIB < SIZE_GROWN_KIB )); then
82+
echo "FAIL: device size $cur_kib < $SIZE_GROWN_KIB after 60s (tolerance ${TOLERANCE_KIB})"
8283
exit 1
8384
fi
8485

tests/e2e/resize-plain.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,22 @@ echo ">> resize via REST → $SIZE_GROWN_KIB KiB"
3939
rest_put "/v1/resource-definitions/${RD}/volume-definitions/0" \
4040
"{\"size_kib\":${SIZE_GROWN_KIB}}"
4141

42+
# DRBD reserves ~44 KiB for internal metadata, so the visible /dev/drbdN
43+
# size after resize is `requested - <small>`. Accept ≥99% of the
44+
# requested size as a successful grow.
45+
TOLERANCE_KIB=128
4246
deadline=$(( $(date +%s) + 60 ))
4347
while (( $(date +%s) < deadline )); do
4448
cur=$(on_node "$N1" bash -c "blockdev --getsize64 ${DEV}" 2>/dev/null || true)
4549
cur=$(( ${cur:-0} / 1024 ))
46-
if (( cur >= SIZE_GROWN_KIB )); then
50+
if (( cur + TOLERANCE_KIB >= SIZE_GROWN_KIB )); then
4751
break
4852
fi
4953
sleep 2
5054
done
5155

52-
if (( cur < SIZE_GROWN_KIB )); then
53-
echo "FAIL: device size $cur KiB < $SIZE_GROWN_KIB"
56+
if (( cur + TOLERANCE_KIB < SIZE_GROWN_KIB )); then
57+
echo "FAIL: device size $cur KiB < $SIZE_GROWN_KIB (tolerance ${TOLERANCE_KIB})"
5458
exit 1
5559
fi
5660

0 commit comments

Comments
 (0)