iptb-lib: add startup_cluster()

While at it let's cleanup startup_cluster() too.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
This commit is contained in:
Christian Couder 2016-02-01 23:09:54 +01:00
parent 8b875ebe77
commit e0a48ffcf6
2 changed files with 20 additions and 21 deletions

View File

@ -17,3 +17,23 @@ check_has_connection() {
grep "ipfs" "swarm_peers_$node" >/dev/null
}
startup_cluster() {
num_nodes="$1"
bound=$(expr $num_nodes - 1)
test_expect_success "start up nodes" '
iptb start
'
test_expect_success "connect nodes to eachother" '
iptb connect [1-$bound] 0
'
for i in $(test_seq 1 $bound)
do
test_expect_success "node $i is connected" '
check_has_connection "$i" ||
test_fsh cat "swarm_peers_$i"
'
done
}

View File

@ -14,27 +14,6 @@ test_expect_success "set up an iptb cluster" '
iptb init -n $num_nodes -p 0 -f --bootstrap=none
'
startup_cluster() {
bound=`expr $num_nodes - 1`
test_expect_success "start up nodes" '
iptb start
'
test_expect_success "connect nodes to eachother" '
iptb connect [1-$bound] 0
'
test_expect_success "nodes are connected" '
for i in `seq $bound`
do
if ! check_has_connection $i; then
echo "oh shit guys"
return 1
fi
done
'
}
startup_cluster $num_nodes
test_expect_success "add an obect on one node" '