-
-
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.
- Loading branch information
1 parent
546415b
commit db98e77
Showing
1 changed file
with
40 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/sh | ||
# | ||
# Copyright (c) 2015 Jeromy Johnson | ||
# MIT Licensed; see the LICENSE file in this repository. | ||
# | ||
|
||
test_description="test two nodes transferring a large file" | ||
|
||
. lib/test-lib.sh | ||
|
||
export IPTB_ROOT="`pwd`/.iptb" | ||
|
||
test_expect_success "set up two nodes" ' | ||
IPTB_PORT=$((RANDOM % 10000 + 22000)) && | ||
iptb -n=2 "-p=$IPTB_PORT" init && | ||
iptb -wait start | ||
' | ||
|
||
test_expect_success "add a file on node1" ' | ||
export IPFS_PATH="$IPTB_ROOT/0" && | ||
random 400000000 > filea && | ||
FILEA_HASH=$(ipfs add -q filea) | ||
' | ||
|
||
test_expect_success "cat that file on node2" ' | ||
export IPFS_PATH="$IPTB_ROOT/1" && | ||
ipfs cat $FILEA_HASH >fileb | ||
' | ||
|
||
test_expect_success "verify files match" ' | ||
multihash filea > expected1 && | ||
multihash fileb > actual1 && | ||
test_cmp actual1 expected1 | ||
' | ||
|
||
test_expect_success "shut down nodes" ' | ||
iptb stop | ||
' | ||
|
||
test_done |