sharness: add lib/iptb-lib.sh
License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Christian Couder committed
Feb 1, 2016 at 13:17 UTC
cacb1cc2d4fdb7c7bc844a4653d4947be4fee646
3 files changed
+21
-13
test/sharness/lib/iptb-lib.sh
new
+18
@@ -0,0 +1,18 @@
1
+# iptb test framework
2
+#
3
+# Copyright (c) 2014, 2016 Jeromy Johnson, Christian Couder
4
+# MIT Licensed; see the LICENSE file in this repository.
5
+
6
+export IPTB_ROOT="`pwd`/.iptb"
7
+
8
+ipfsi() {
9
+ dir="$1"
10
+ shift
11
+ IPFS_PATH="$IPTB_ROOT/$dir" ipfs $@
12
+}
13
+
14
+check_has_connection() {
15
+ node=$1
16
+ ipfsi $node swarm peers | grep ipfs > /dev/null
17
+}
18
+
test/sharness/lib/test-lib.sh
+3
@@ -53,6 +53,9 @@ fi
53
# source our generic test lib
54
. ../../ipfs-test-lib.sh
55
56
+# source iptb lib
57
+. ../lib/iptb-lib.sh
58
+
59
test_cmp_repeat_10_sec() {
60
for i in $(test_seq 1 100)
61
do
test/sharness/t0101-iptb-name.sh
-13
@@ -8,25 +8,12 @@ test_description="Test ipfs repo operations"
8
9
. lib/test-lib.sh
10
11
-export IPTB_ROOT="`pwd`/.iptb"
12
-
11
num_nodes=4
12
15
-ipfsi() {
16
- dir="$1"
17
- shift
18
- IPFS_PATH="$IPTB_ROOT/$dir" ipfs $@
19
-}
20
-
13
test_expect_success "set up an iptb cluster" '
14
iptb init -n $num_nodes -p 0 -f --bootstrap=none
15
'
16
25
-check_has_connection() {
26
- node=$1
27
- ipfsi $node swarm peers | grep ipfs > /dev/null
28
-}
29
-
17
startup_cluster() {
18
bound=`expr $num_nodes - 1`
19
test_expect_success "start up nodes" '