From 262f43fb55ef8d1644b4bca8a71225c1e1c41ca5 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Wed, 5 Mar 2025 21:04:24 +0100 Subject: [PATCH] test: fix flaky repo verify it seems verify not always notices file was broken, this fix performs explicit flush and assumes CI uses filesystem with lazy flush or some other unknown behavior --- test/sharness/t0086-repo-verify.sh | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/test/sharness/t0086-repo-verify.sh b/test/sharness/t0086-repo-verify.sh index 0f12fef8f82..b6f46ec53af 100755 --- a/test/sharness/t0086-repo-verify.sh +++ b/test/sharness/t0086-repo-verify.sh @@ -26,20 +26,14 @@ sort_rand() { check_random_corruption() { to_break=$(find "$IPFS_PATH/blocks" -type f -name '*.data' | sort_rand | head -n 1) - test_expect_success "back up file and overwrite it" ' - cp "$to_break" backup_file && - echo "this is super broken" > "$to_break" - ' - - test_expect_success "repo verify detects failure" ' + test_expect_success "repo verify detects a failure" ' + mv "$to_break" backup_file && + echo -n "this block will not match expected hash" > "$to_break" && test_expect_code 1 ipfs repo verify ' - test_expect_success "replace the object" ' - cp backup_file "$to_break" - ' - - test_expect_success "ipfs repo verify passes just fine now" ' + test_expect_success "repo verify passes once a failure is fixed" ' + mv backup_file "$to_break" && ipfs repo verify ' }