reenable ipns sharness test now that iptb is fixed
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
Jeromy committed
Jan 1, 2016 at 19:38 UTC
ba33de36e3418507adf368072599f0cacb5f56bb
2 files changed
+80
-50
test/sharness/t0101-iptb-name.sh
new
+80
@@ -0,0 +1,80 @@
1
+#!/bin/sh
2
+#
3
+# Copyright (c) 2014 Jeromy Johnson
4
+# MIT Licensed; see the LICENSE file in this repository.
5
+#
6
+
7
+test_description="Test ipfs repo operations"
8
+
9
+. lib/test-lib.sh
10
+
11
+export IPTB_ROOT="`pwd`/.iptb"
12
+
13
+num_nodes=4
14
+
15
+ipfsi() {
16
+ dir="$1"
17
+ shift
18
+ IPFS_PATH="$IPTB_ROOT/$dir" ipfs $@
19
+}
20
+
21
+test_expect_success "set up an iptb cluster" '
22
+ iptb init -n $num_nodes -p 0 -f --bootstrap=none
23
+'
24
+
25
+check_has_connection() {
26
+ node=$1
27
+ ipfsi $node swarm peers | grep ipfs > /dev/null
28
+}
29
+
30
+startup_cluster() {
31
+ bound=`expr $num_nodes - 1`
32
+ test_expect_success "start up nodes" '
33
+ iptb start
34
+ '
35
+
36
+ test_expect_success "connect nodes to eachother" '
37
+ iptb connect [1-$bound] 0
38
+ '
39
+
40
+ test_expect_success "nodes are connected" '
41
+ for i in `seq $bound`
42
+ do
43
+ if ! check_has_connection $i; then
44
+ echo "oh shit guys"
45
+ return 1
46
+ fi
47
+ done
48
+ '
49
+}
50
+
51
+startup_cluster $num_nodes
52
+
53
+test_expect_success "add an obect on one node" '
54
+ echo "ipns is super fun" > file &&
55
+ HASH_FILE=$(ipfsi 1 add -q file)
56
+'
57
+
58
+test_expect_success "publish that object as an ipns entry" '
59
+ ipfsi 1 name publish $HASH_FILE
60
+'
61
+
62
+test_expect_success "add an entry on another node pointing to that one" '
63
+ NODE1_ID=$(iptb get id 1) &&
64
+ ipfsi 2 name publish /ipns/$NODE1_ID
65
+'
66
+
67
+test_expect_success "cat that entry on a third node" '
68
+ NODE2_ID=$(iptb get id 2) &&
69
+ ipfsi 3 cat /ipns/$NODE2_ID > output
70
+'
71
+
72
+test_expect_success "ensure output was the same" '
73
+ test_cmp file output
74
+'
75
+
76
+test_expect_success "shut down iptb" '
77
+ iptb stop
78
+'
79
+
80
+test_done
test/sharness/xt0101-iptb-name.sh
deleted
-50
@@ -1,50 +0,0 @@
1
-#!/bin/sh
2
-#
3
-# Copyright (c) 2014 Jeromy Johnson
4
-# MIT Licensed; see the LICENSE file in this repository.
5
-#
6
-
7
-test_description="Test ipfs repo operations"
8
-
9
-. lib/test-lib.sh
10
-
11
-export IPTB_ROOT="`pwd`/.iptb"
12
-
13
-
14
-test_expect_success "set up an iptb cluster" '
15
- IPTB_PORT=$((RANDOM % 10000 + 22000)) &&
16
- iptb -n=4 "-p=$IPTB_PORT" init &&
17
- iptb -wait start
18
-'
19
-
20
-test_expect_success "add an obect on one node" '
21
- export IPFS_PATH="$IPTB_ROOT/1" &&
22
- echo "ipns is super fun" > file &&
23
- HASH_FILE=`ipfs add -q file`
24
-'
25
-
26
-test_expect_success "publish that object as an ipns entry" '
27
- ipfs name publish $HASH_FILE
28
-'
29
-
30
-test_expect_success "add an entry on another node pointing to that one" '
31
- export IPFS_PATH="$IPTB_ROOT/2" &&
32
- NODE1_ID=`iptb get id 1` &&
33
- ipfs name publish /ipns/$NODE1_ID
34
-'
35
-
36
-test_expect_success "cat that entry on a third node" '
37
- export IPFS_PATH="$IPTB_ROOT/3" &&
38
- NODE2_ID=`iptb get id 2` &&
39
- ipfs cat /ipns/$NODE2_ID > output
40
-'
41
-
42
-test_expect_success "ensure output was the same" '
43
- test_cmp file output
44
-'
45
-
46
-test_expect_success "shut down iptb" '
47
- iptb stop
48
-'
49
-
50
-test_done