mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-26 04:47:45 +08:00
sharness: add lib/iptb-lib.sh
License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
This commit is contained in:
parent
ba148b2355
commit
cacb1cc2d4
18
test/sharness/lib/iptb-lib.sh
Normal file
18
test/sharness/lib/iptb-lib.sh
Normal 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
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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" '
|
||||
|
||||
Loading…
Reference in New Issue
Block a user