Skip to content

Commit 4978ade

Browse files
committed
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
1 parent e221e94 commit 4978ade

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

test/sharness/t0086-repo-verify.sh

+9-9
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ sort_rand() {
2626
check_random_corruption() {
2727
to_break=$(find "$IPFS_PATH/blocks" -type f -name '*.data' | sort_rand | head -n 1)
2828

29-
test_expect_success "back up file and overwrite it" '
30-
cp "$to_break" backup_file &&
31-
echo "this is super broken" > "$to_break"
29+
test_expect_success "ipfs repo verify passes" '
30+
ipfs repo verify
3231
'
3332

34-
test_expect_success "repo verify detects failure" '
33+
test_expect_success "repo verify detects a failure" '
34+
mv "$to_break" backup_file &&
35+
echo -n "this block will not match expected hash" > "$to_break" &&
36+
sync "$IPFS_PATH" &&
3537
test_expect_code 1 ipfs repo verify
3638
'
3739

38-
test_expect_success "replace the object" '
39-
cp backup_file "$to_break"
40-
'
41-
42-
test_expect_success "ipfs repo verify passes just fine now" '
40+
test_expect_success "restore broken object and confirm repo verify passes again" '
41+
mv backup_file "$to_break" &&
42+
sync "$IPFS_PATH" &&
4343
ipfs repo verify
4444
'
4545
}

0 commit comments

Comments
 (0)