From e0a48ffcf6485c73c2cec5e7345c9cc88bfcf1af Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Mon, 1 Feb 2016 23:09:54 +0100 Subject: [PATCH] iptb-lib: add startup_cluster() While at it let's cleanup startup_cluster() too. License: MIT Signed-off-by: Christian Couder --- test/sharness/lib/iptb-lib.sh | 20 ++++++++++++++++++++ test/sharness/t0101-iptb-name.sh | 21 --------------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/test/sharness/lib/iptb-lib.sh b/test/sharness/lib/iptb-lib.sh index 6efb4b8c7..3ba09e791 100644 --- a/test/sharness/lib/iptb-lib.sh +++ b/test/sharness/lib/iptb-lib.sh @@ -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 +} diff --git a/test/sharness/t0101-iptb-name.sh b/test/sharness/t0101-iptb-name.sh index 21c8987d4..3dbea47da 100755 --- a/test/sharness/t0101-iptb-name.sh +++ b/test/sharness/t0101-iptb-name.sh @@ -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" '