-
-
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.
Merge pull request #248 from chriscool/test_ipfs_mount
Add test for ipfs mount
- Loading branch information
Showing
4 changed files
with
146 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
test-results/ | ||
trash directory.*.sh/ |
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,15 @@ | ||
#!/bin/sh | ||
# | ||
# Copyright (c) 2014 Christian Couder | ||
# MIT Licensed; see the LICENSE file in this repository. | ||
# | ||
|
||
test_description="Test mount command" | ||
|
||
. ./test-lib.sh | ||
|
||
test_launch_ipfs_mount | ||
|
||
test_kill_ipfs_mount | ||
|
||
test_done |
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,84 @@ | ||
#!/bin/sh | ||
# | ||
# Copyright (c) 2014 Christian Couder | ||
# MIT Licensed; see the LICENSE file in this repository. | ||
# | ||
|
||
test_description="Test add and cat commands" | ||
|
||
. ./test-lib.sh | ||
|
||
test_launch_ipfs_mount | ||
|
||
test_expect_success "ipfs add succeeds" ' | ||
echo "Hello Worlds!" >mountdir/hello.txt && | ||
ipfs add mountdir/hello.txt >actual | ||
' | ||
|
||
test_expect_success "ipfs add output looks good" ' | ||
HASH="QmVr26fY1tKyspEJBniVhqxQeEjhF78XerGiqWAwraVLQH" && | ||
echo "added $HASH $(pwd)/mountdir/hello.txt" >expected && | ||
test_cmp expected actual | ||
' | ||
|
||
test_expect_success "ipfs cat succeeds" ' | ||
ipfs cat $HASH >actual | ||
' | ||
|
||
test_expect_success "ipfs cat output looks good" ' | ||
echo "Hello Worlds!" >expected && | ||
test_cmp expected actual | ||
' | ||
|
||
test_expect_success "cat ipfs/stuff succeeds" ' | ||
cat ipfs/$HASH >actual | ||
' | ||
|
||
test_expect_success "cat ipfs/stuff looks good" ' | ||
test_cmp expected actual | ||
' | ||
|
||
test_expect_success "go-random is installed" ' | ||
type random | ||
' | ||
|
||
test_expect_success "generate 100MB file using go-random" ' | ||
random 104857600 42 >mountdir/bigfile | ||
' | ||
|
||
test_expect_success "sha1 of the file looks ok" ' | ||
echo "54dc0dbbc353b2ffb745285793f89af0c9d98449 mountdir/bigfile" >sha1_expected && | ||
sha1sum mountdir/bigfile >sha1_actual && | ||
test_cmp sha1_expected sha1_actual | ||
' | ||
|
||
test_expect_success "ipfs add bigfile succeeds" ' | ||
ipfs add mountdir/bigfile >actual | ||
' | ||
|
||
test_expect_success "ipfs add bigfile output looks good" ' | ||
HASH="QmeZVkWkDu4W1vxWdDgUbqKYba9K3u45hJEdPA4Wr2sHZz" && | ||
echo "added $HASH $(pwd)/mountdir/bigfile" >expected && | ||
test_cmp expected actual | ||
' | ||
|
||
test_expect_success "ipfs cat succeeds" ' | ||
ipfs cat $HASH | sha1sum >sha1_actual | ||
' | ||
|
||
test_expect_success "ipfs cat output looks good" ' | ||
echo "54dc0dbbc353b2ffb745285793f89af0c9d98449 -" >sha1_expected && | ||
test_cmp sha1_expected sha1_actual | ||
' | ||
|
||
test_expect_success "cat ipfs/bigfile succeeds" ' | ||
cat ipfs/$HASH | sha1sum >sha1_actual | ||
' | ||
|
||
test_expect_success "cat ipfs/bigfile looks good" ' | ||
test_cmp sha1_expected sha1_actual | ||
' | ||
|
||
test_kill_ipfs_mount | ||
|
||
test_done |
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