Skip to content

Commit 262f43f

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 262f43f

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

test/sharness/t0086-repo-verify.sh

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,14 @@ 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"
32-
'
33-
34-
test_expect_success "repo verify detects failure" '
29+
test_expect_success "repo verify detects a failure" '
30+
mv "$to_break" backup_file &&
31+
echo -n "this block will not match expected hash" > "$to_break" &&
3532
test_expect_code 1 ipfs repo verify
3633
'
3734

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" '
35+
test_expect_success "repo verify passes once a failure is fixed" '
36+
mv backup_file "$to_break" &&
4337
ipfs repo verify
4438
'
4539
}

0 commit comments

Comments
 (0)