Skip to content
Snippets Groups Projects
Unverified Commit 262f43fb authored by Marcin Rataj's avatar Marcin Rataj
Browse files

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
parent e221e941
Branches
Tags
No related merge requests found
...@@ -26,20 +26,14 @@ sort_rand() { ...@@ -26,20 +26,14 @@ sort_rand() {
check_random_corruption() { check_random_corruption() {
to_break=$(find "$IPFS_PATH/blocks" -type f -name '*.data' | sort_rand | head -n 1) to_break=$(find "$IPFS_PATH/blocks" -type f -name '*.data' | sort_rand | head -n 1)
test_expect_success "back up file and overwrite it" ' test_expect_success "repo verify detects a failure" '
cp "$to_break" backup_file && mv "$to_break" backup_file &&
echo "this is super broken" > "$to_break" echo -n "this block will not match expected hash" > "$to_break" &&
'
test_expect_success "repo verify detects failure" '
test_expect_code 1 ipfs repo verify test_expect_code 1 ipfs repo verify
' '
test_expect_success "replace the object" ' test_expect_success "repo verify passes once a failure is fixed" '
cp backup_file "$to_break" mv backup_file "$to_break" &&
'
test_expect_success "ipfs repo verify passes just fine now" '
ipfs repo verify ipfs repo verify
' '
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment