mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-26 12:57:44 +08:00
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:
parent
8b875ebe77
commit
e0a48ffcf6
@ -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
|
||||
}
|
||||
|
||||
@ -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" '
|
||||
|
||||
Loading…
Reference in New Issue
Block a user