x0045-add-cat-iptb.sh 819 Bytes
Newer Older
Jeromy's avatar
Jeromy committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
#!/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 &&
33
	test_cmp expected1 actual1
Jeromy's avatar
Jeromy committed
34 35 36 37 38 39 40
'

test_expect_success "shut down nodes" '
	iptb stop
'

test_done