Skip to content

Commit

Permalink
test: fix flaky repo verify
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lidel committed Mar 5, 2025
1 parent e221e94 commit 262f43f
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions test/sharness/t0086-repo-verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
'
}
Expand Down

0 comments on commit 262f43f

Please sign in to comment.