-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Filestore.Verify config option to control when block are verified.
The default value if "ifchanged" and blocks are only verified when the backing file has changed. License: MIT Signed-off-by: Kevin Atkinson <[email protected]>
- Loading branch information
Showing
5 changed files
with
92 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/sh | ||
# | ||
# Copyright (c) 2014 Christian Couder | ||
# MIT Licensed; see the LICENSE file in this repository. | ||
# | ||
|
||
test_description="Test filestore" | ||
|
||
. lib/test-filestore-lib.sh | ||
. lib/test-lib.sh | ||
|
||
test_init_ipfs | ||
|
||
test_add_cat_file "add --no-copy" "." | ||
|
||
export IPFS_LOGGING=debug | ||
export IPFS_LOGGING_FMT=nocolor | ||
|
||
HASH="QmVr26fY1tKyspEJBniVhqxQeEjhF78XerGiqWAwraVLQH" | ||
|
||
test_expect_success "file always checked" ' | ||
ipfs config Filestore.Verify always 2> log && | ||
ipfs cat "$HASH" 2> log && | ||
grep -q "verifying block $HASH" log && | ||
! grep -q "updating block $HASH" log | ||
' | ||
|
||
test_expect_success "file checked after change" ' | ||
ipfs config Filestore.Verify ifchanged 2> log && | ||
echo "HELLO WORLDS!" >mountdir/hello.txt && | ||
test_must_fail ipfs cat "$HASH" 2> log && | ||
grep -q "verifying block $HASH" log && | ||
grep -q "updating block $HASH" log | ||
' | ||
|
||
test_expect_success "file never checked" ' | ||
echo "Hello Worlds!" >mountdir/hello.txt && | ||
ipfs add "$dir"/mountdir/hello.txt >actual 2> log && | ||
ipfs config Filestore.Verify never 2> log && | ||
echo "HELLO Worlds!" >mountdir/hello.txt && | ||
( ipfs cat "$HASH" || true ) 2> log && | ||
grep -q "BlockService GetBlock" log && # Make sure we are still logging | ||
! grep -q "verifying block $HASH" log && | ||
! grep -q "updating block $HASH" log | ||
' | ||
|
||
test_done |