@cryptotaxi247 / kubo / commits / e0a48ffcf

iptb-lib: add startup_cluster()

While at it let's cleanup startup_cluster() too. License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>

Christian Couder committed Feb 1, 2016 at 23:09 UTC e0a48ffcf6485c73c2cec5e7345c9cc88bfcf1af
2 files changed +20 -21
test/sharness/lib/iptb-lib.sh
+20
@@ -17,3 +17,23 @@ check_has_connection() {
17 grep "ipfs" "swarm_peers_$node" >/dev/null
18 }
19
20 +startup_cluster() {
21 + num_nodes="$1"
22 + bound=$(expr $num_nodes - 1)
23 +
24 + test_expect_success "start up nodes" '
25 + iptb start
26 + '
27 +
28 + test_expect_success "connect nodes to eachother" '
29 + iptb connect [1-$bound] 0
30 + '
31 +
32 + for i in $(test_seq 1 $bound)
33 + do
34 + test_expect_success "node $i is connected" '
35 + check_has_connection "$i" ||
36 + test_fsh cat "swarm_peers_$i"
37 + '
38 + done
39 +}
test/sharness/t0101-iptb-name.sh
-21
@@ -14,27 +14,6 @@ test_expect_success "set up an iptb cluster" '
14 iptb init -n $num_nodes -p 0 -f --bootstrap=none
15 '
16
17 -startup_cluster() {
18 - bound=`expr $num_nodes - 1`
19 - test_expect_success "start up nodes" '
20 - iptb start
21 - '
22 -
23 - test_expect_success "connect nodes to eachother" '
24 - iptb connect [1-$bound] 0
25 - '
26 -
27 - test_expect_success "nodes are connected" '
28 - for i in `seq $bound`
29 - do
30 - if ! check_has_connection $i; then
31 - echo "oh shit guys"
32 - return 1
33 - fi
34 - done
35 - '
36 -}
37 -
17 startup_cluster $num_nodes
18
19 test_expect_success "add an obect on one node" '