test: fix flaky repo verify (#10743)
The test was flaky because `ipfs repo verify` doesn't detect corruption of the empty directory block (served from memory even when corrupted on disk). Exclude both empty file and empty directory blocks from random corruption to make the test reliable. --------- Co-authored-by: Andrew Gillis <11790789+gammazero@users.noreply.github.com>
Marcin Rataj committed
Aug 15, 2025 at 05:21 UTC
1ca5c9dd84dfcbb8385995c04251c878efa56b32
1 file changed
+4
-1
test/sharness/t0086-repo-verify.sh
+4
-1
@@ -24,7 +24,10 @@ sort_rand() {
24
}
25
26
check_random_corruption() {
27
- to_break=$(find "$IPFS_PATH/blocks" -type f -name '*.data' | sort_rand | head -n 1)
27
+ # Exclude well-known blocks from corruption as they cause test flakiness:
28
+ # - CIQL7TG2PB52XIZLLHDYIUFMHUQLMMZWBNBZSLDXFCPZ5VDNQQ2WDZQ.data: empty file block
29
+ # - CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data: empty directory block (has special handling, served from memory even when corrupted on disk)
30
+ to_break=$(find "$IPFS_PATH/blocks" -type f -name '*.data' | grep -v -E "CIQL7TG2PB52XIZLLHDYIUFMHUQLMMZWBNBZSLDXFCPZ5VDNQQ2WDZQ.data|CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data" | sort_rand | head -n 1)
31
32
test_expect_success "back up file and overwrite it" '
33
cp "$to_break" backup_file &&