From 1ca5c9dd84dfcbb8385995c04251c878efa56b32 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Fri, 15 Aug 2025 05:21:56 +0200 Subject: [PATCH] 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> --- test/sharness/t0086-repo-verify.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/sharness/t0086-repo-verify.sh b/test/sharness/t0086-repo-verify.sh index 0f12fef8f..612d281ef 100755 --- a/test/sharness/t0086-repo-verify.sh +++ b/test/sharness/t0086-repo-verify.sh @@ -24,7 +24,10 @@ sort_rand() { } check_random_corruption() { - to_break=$(find "$IPFS_PATH/blocks" -type f -name '*.data' | sort_rand | head -n 1) + # Exclude well-known blocks from corruption as they cause test flakiness: + # - CIQL7TG2PB52XIZLLHDYIUFMHUQLMMZWBNBZSLDXFCPZ5VDNQQ2WDZQ.data: empty file block + # - CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data: empty directory block (has special handling, served from memory even when corrupted on disk) + to_break=$(find "$IPFS_PATH/blocks" -type f -name '*.data' | grep -v -E "CIQL7TG2PB52XIZLLHDYIUFMHUQLMMZWBNBZSLDXFCPZ5VDNQQ2WDZQ.data|CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data" | sort_rand | head -n 1) test_expect_success "back up file and overwrite it" ' cp "$to_break" backup_file &&