Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
727aea1f
Commit
727aea1f
authored
Jan 07, 2019
by
Kevin Atkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enhance ipfs add --cid-base32 tests.
License: MIT Signed-off-by:
Kevin Atkinson
<
k@kevina.org
>
parent
57457af7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
12 deletions
+40
-12
test/sharness/t0040-add-and-cat.sh
test/sharness/t0040-add-and-cat.sh
+40
-12
No files found.
test/sharness/t0040-add-and-cat.sh
View file @
727aea1f
...
...
@@ -276,32 +276,55 @@ test_add_cat_file() {
# --cid-base=base32
test_expect_success
"ipfs add --cid-base=base32 succeeds"
'
echo "
Hello Worlds!
" >mountdir/
hello
.txt &&
ipfs add --cid-base=base32 mountdir/
hello
.txt >actual
echo "
base32 test
" >mountdir/
base32-test
.txt &&
ipfs add --cid-base=base32 mountdir/
base32-test
.txt >actual
'
test_expect_success
"ipfs add output looks good"
'
HASH="bafybeidpq7lcjx4w5c6yr4vuthzvlav54hgxsremwk73to5ferdc2rxhai" &&
echo "added $HASH hello.txt" >expected &&
test_expect_success
"ipfs add --cid-base=base32 output looks good"
'
HASHb32="bafybeibyosqxljd2eptb4ebbtvk7pb4aoxzqa6ttdsflty6rsslz5y6i34" &&
echo "added $HASHb32 base32-test.txt" >expected &&
test_cmp expected actual
'
test_expect_success
"ipfs add --cid-base=base32 --only-hash succeeds"
'
ipfs add --cid-base=base32 --only-hash mountdir/hello.txt > oh_actual
ipfs add --cid-base=base32 --only-hash mountdir/base32-test.txt > oh_actual
'
test_expect_success
"ipfs add --cid-base=base32 --only-hash output looks good"
'
test_cmp expected oh_actual
'
test_expect_success
"ipfs add --only-hash output looks good"
'
test_expect_success
"ipfs add --cid-base=base32 --force-cid-base=false succeeds"
'
echo "base32 test" >mountdir/base32-test.txt &&
ipfs add --cid-base=base32 --force-cid-base=false mountdir/base32-test.txt >actual
'
test_expect_success
"ipfs add --cid-base=base32 --force-cid-base=false output looks good"
'
HASHv0=$(cid-fmt -v 0 -b z %s "$HASHb32") &&
echo "added $HASHv0 base32-test.txt" >expected &&
test_cmp expected actual
'
test_expect_success
"ipfs add --cid-base=base32 --force-cid-base=false --only-hash succeeds"
'
ipfs add --cid-base=base32 --force-cid-base=false --only-hash mountdir/base32-test.txt > oh_actual
'
test_expect_success
"ipfs add --cid-base=base32 --force-cid-base=false --only-hash output looks good"
'
test_cmp expected oh_actual
'
test_expect_success
"ipfs cat succeeds"
'
ipfs cat "$HASH" >actual
test_expect_success
"ipfs cat with base32 hash succeeds"
'
ipfs cat "$HASHb32" >actual
'
test_expect_success
"ipfs cat with base32 hash output looks good"
'
echo "base32 test" >expected &&
test_cmp expected actual
'
test_expect_success
"ipfs cat output looks good"
'
echo "Hello Worlds!" >expected &&
test_expect_success
"ipfs cat using CIDv0 hash succeeds"
'
ipfs cat "$HASHv0" >actual
'
test_expect_success
"ipfs cat using CIDv0 hash looks good"
'
echo "base32 test" >expected &&
test_cmp expected actual
'
}
test_add_cat_5MB
()
{
...
...
@@ -343,6 +366,11 @@ test_add_cat_5MB() {
test_cmp mountdir/bigfile actual
'
test_expect_success
"remove hash"
'
ipfs pin rm "$EXP_HASH" &&
ipfs block rm "$EXP_HASH"
'
test_expect_success
"get base32 version of CID"
'
ipfs cid base32 $EXP_HASH > base32_cid &&
BASE32_HASH=`cat base32_cid`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment