-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add initial support for identity hashes (Part 1) #5117
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/usr/bin/env bash | ||
|
||
test_description="Test basic operations with identity hash" | ||
|
||
. lib/test-lib.sh | ||
|
||
test_init_ipfs | ||
|
||
ID_HASH0=z25RnHTQ7DveGAsV6YDSDR8EkWvD | ||
ID_HASH0_CONTENTS=jkD98jkD975hkD8 | ||
|
||
test_expect_success "can fetch random id hash" ' | ||
ipfs cat $ID_HASH0 > expected && | ||
echo $ID_HASH0_CONTENTS > actual && | ||
test_cmp expected actual | ||
' | ||
|
||
test_expect_success "can pin random id hash" ' | ||
ipfs pin add $ID_HASH0 | ||
' | ||
|
||
test_expect_success "ipfs add succeeds with id hash" ' | ||
echo "djkd7jdkd7jkHHG" > junk.txt && | ||
HASH=$(ipfs add -q --hash=id junk.txt) | ||
' | ||
|
||
test_expect_success "content not actually added" ' | ||
ipfs refs local | fgrep -q -v $HASH | ||
' | ||
|
||
test_expect_success "but can fetch it anyway" ' | ||
ipfs cat $HASH > actual && | ||
test_cmp junk.txt actual | ||
' | ||
|
||
test_expect_success "block rm does nothing" ' | ||
ipfs pin rm $HASH && | ||
ipfs block rm $HASH | ||
' | ||
|
||
test_expect_success "can still fetch it" ' | ||
ipfs cat $HASH > actual | ||
test_cmp junk.txt actual | ||
' | ||
|
||
test_expect_success "enable filestore" ' | ||
ipfs config --json Experimental.FilestoreEnabled true | ||
' | ||
|
||
test_expect_success "can fetch random id hash (filestore enabled)" ' | ||
ipfs cat $ID_HASH0 > expected && | ||
echo $ID_HASH0_CONTENTS > actual && | ||
test_cmp expected actual | ||
' | ||
|
||
test_expect_success "can pin random id hash (filestore enabled)" ' | ||
ipfs pin add $ID_HASH0 | ||
' | ||
|
||
test_expect_success "ipfs add succeeds with id hash and --nocopy" ' | ||
echo "djkd7jdkd7jkHHG" > junk.txt && | ||
HASH=$(ipfs add -q --hash=id --nocopy junk.txt) | ||
' | ||
|
||
test_expect_success "content not actually added (filestore enabled)" ' | ||
ipfs refs local | fgrep -q -v $HASH | ||
' | ||
|
||
test_expect_success "but can fetch it anyway (filestore enabled)" ' | ||
ipfs cat $HASH > actual && | ||
test_cmp junk.txt actual | ||
' | ||
|
||
test_done |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit: why is the
CachedBlockstore
renamed fromcbs
towbs
? Shouldn'twbs
(which I'm not sure what it stands for) be defined later inNewIdStore
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wbs
stands for wrapped-data-store.I could keep
cbs
and then defined yet another variable. But that could lead to bugs wherecbs
was used whenwbs
was meant to be used.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I was just saying because the following self-definition seem a bit weird to me,
and I would have expected to create it from another blockstore, not from itself, like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be named
wds
instead? To avoid confusing it with a blockstore (likecbs
).