sharness: add lib/iptb-lib.sh

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
This commit is contained in:
Christian Couder 2016-02-01 13:17:13 +01:00
parent ba148b2355
commit cacb1cc2d4
3 changed files with 21 additions and 13 deletions

View File

@ -0,0 +1,18 @@
# iptb test framework
#
# Copyright (c) 2014, 2016 Jeromy Johnson, Christian Couder
# MIT Licensed; see the LICENSE file in this repository.
export IPTB_ROOT="`pwd`/.iptb"
ipfsi() {
dir="$1"
shift
IPFS_PATH="$IPTB_ROOT/$dir" ipfs $@
}
check_has_connection() {
node=$1
ipfsi $node swarm peers | grep ipfs > /dev/null
}

View File

@ -53,6 +53,9 @@ fi
# source our generic test lib
. ../../ipfs-test-lib.sh
# source iptb lib
. ../lib/iptb-lib.sh
test_cmp_repeat_10_sec() {
for i in $(test_seq 1 100)
do

View File

@ -8,25 +8,12 @@ test_description="Test ipfs repo operations"
. lib/test-lib.sh
export IPTB_ROOT="`pwd`/.iptb"
num_nodes=4
ipfsi() {
dir="$1"
shift
IPFS_PATH="$IPTB_ROOT/$dir" ipfs $@
}
test_expect_success "set up an iptb cluster" '
iptb init -n $num_nodes -p 0 -f --bootstrap=none
'
check_has_connection() {
node=$1
ipfsi $node swarm peers | grep ipfs > /dev/null
}
startup_cluster() {
bound=`expr $num_nodes - 1`
test_expect_success "start up nodes" '