@cryptotaxi247 / kubo / commits / 569eeb8f8

Update IPTB test - WIP

Related to #5521 License: MIT Signed-off-by: Travis Person <travis@protocol.ai>

Travis Person committed Oct 23, 2018 at 11:17 UTC 569eeb8f82d613bfefffb444cd2c5d56d5f303d6
23 files changed +85 -80
package.json
+2 -2
@@ -47,9 +47,9 @@
47 "version": "0.1.4"
48 },
49 {
50 - "hash": "QmV1DPm5F46LvQMxCVPhu35zHgZEeMvyVtpxjb5TwfGiua",
50 + "hash": "QmU5w6sBozzDcfHXuKn1ZZAYuBw1rE57YYRVxgUcCjEX8C",
51 "name": "iptb",
52 - "version": "1.3.19"
52 + "version": "2.0.0"
53 },
54 {
55 "hash": "QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8",
test/bin/Rules.mk
+5 -1
@@ -14,6 +14,10 @@ $(d)/go-timeout: test/dependencies/go-timeout
14 $(go-build)
15 TGTS_$(d) += $(d)/go-timeout
16
17 +$(d)/iptb: test/dependencies/iptb
18 + $(go-build)
19 +TGTS_$(d) += $(d)/iptb
20 +
21 $(d)/ma-pipe-unidir: test/dependencies/ma-pipe-unidir
22 $(go-build)
23 TGTS_$(d) += $(d)/ma-pipe-unidir
@@ -22,7 +26,7 @@ $(d)/json-to-junit: test/dependencies/json-to-junit
26 $(go-build)
27 TGTS_$(d) += $(d)/json-to-junit
28
25 -TGTS_GX_$(d) := hang-fds iptb
29 +TGTS_GX_$(d) := hang-fds
30 TGTS_GX_$(d) := $(addprefix $(d)/,$(TGTS_GX_$(d)))
31
32 $(TGTS_GX_$(d)):
test/sharness/lib/iptb-lib.sh
+5 -5
@@ -8,7 +8,7 @@ export IPTB_ROOT="$(pwd)/.iptb"
8 ipfsi() {
9 dir="$1"
10 shift
11 - IPFS_PATH="$IPTB_ROOT/$dir" ipfs "$@"
11 + IPFS_PATH="$IPTB_ROOT/testbeds/default/$dir" ipfs "$@"
12 }
13
14 check_has_connection() {
@@ -21,7 +21,7 @@ iptb() {
21 if ! command iptb "$@"; then
22 case "$1" in
23 start|stop|connect)
24 - test_fsh command iptb logs '*'
24 + test_fsh command iptb logs
25 ;;
26 esac
27 return 1
@@ -36,11 +36,11 @@ startup_cluster() {
36
37 if test -n "$other_args"; then
38 test_expect_success "start up nodes with additional args" "
39 - iptb start --args \"${other_args[@]}\"
39 + iptb start -wait -- ${other_args[@]}
40 "
41 else
42 test_expect_success "start up nodes" '
43 - iptb start
43 + iptb start -wait
44 '
45 fi
46
@@ -58,7 +58,7 @@ startup_cluster() {
58 }
59
60 iptb_wait_stop() {
61 - while ! iptb for-each sh -c '! { test -e "$IPFS_PATH/repo.lock" && fuser -f "$IPFS_PATH/repo.lock" >/dev/null; }'; do
61 + while ! iptb run -- sh -c '! { test -e "$IPFS_PATH/repo.lock" && fuser -f "$IPFS_PATH/repo.lock" >/dev/null; }'; do
62 go-sleep 10ms
63 done
64 }
test/sharness/t0030-mount.sh
+1 -1
@@ -18,7 +18,7 @@ fi
18 # start iptb + wait for peering
19 NUM_NODES=5
20 test_expect_success 'init iptb' '
21 - iptb init -n $NUM_NODES --bootstrap=none --port=0
21 + iptb testbed create -type localipfs -count $NUM_NODES -init
22 '
23 startup_cluster $NUM_NODES
24
test/sharness/t0031-mount-publish.sh
+1 -1
@@ -17,7 +17,7 @@ test_init_ipfs
17 # start iptb + wait for peering
18 NUM_NODES=3
19 test_expect_success 'init iptb' '
20 - iptb init -n $NUM_NODES -f --bootstrap=none --port=0 &&
20 + iptb testbed create -type localipfs -count $NUM_NODES -force -init &&
21 startup_cluster $NUM_NODES
22 '
23
test/sharness/t0041-ping.sh
+3 -3
@@ -10,14 +10,14 @@ BAD_PEER="QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJx"
10
11 # start iptb + wait for peering
12 test_expect_success 'init iptb' '
13 - iptb init -n 2 --bootstrap=none --port=0
13 + iptb testbed create -type localipfs -count 2 -init
14 '
15
16 startup_cluster 2
17
18 test_expect_success 'peer ids' '
19 - PEERID_0=$(iptb get id 0) &&
20 - PEERID_1=$(iptb get id 1)
19 + PEERID_0=$(iptb attr get 0 id) &&
20 + PEERID_1=$(iptb attr get 1 id)
21 '
22
23 test_expect_success "test ping other" '
test/sharness/t0101-iptb-name.sh
+3 -3
@@ -11,7 +11,7 @@ test_description="Test ipfs repo operations"
11 num_nodes=4
12
13 test_expect_success "set up an iptb cluster" '
14 - iptb init -n $num_nodes -p 0 -f --bootstrap=none
14 + iptb testbed create -type localipfs -count $num_nodes -force -init
15 '
16
17 startup_cluster $num_nodes
@@ -26,12 +26,12 @@ test_expect_success "publish that object as an ipns entry" '
26 '
27
28 test_expect_success "add an entry on another node pointing to that one" '
29 - NODE1_ID=$(iptb get id 1) &&
29 + NODE1_ID=$(iptb attr get 1 id) &&
30 ipfsi 2 name publish /ipns/$NODE1_ID
31 '
32
33 test_expect_success "cat that entry on a third node" '
34 - NODE2_ID=$(iptb get id 2) &&
34 + NODE2_ID=$(iptb attr get 2 id) &&
35 ipfsi 3 cat /ipns/$NODE2_ID > output
36 '
37
test/sharness/t0121-bootstrap-iptb.sh
+9 -9
@@ -18,11 +18,11 @@ test_expect_success "disable mdns" '
18 test_launch_ipfs_daemon
19
20 test_expect_success "setup iptb nodes" '
21 - iptb init -n 5 -f --bootstrap=none --port=0
21 + iptb testbed create -type localipfs -count 5 -force -init
22 '
23
24 test_expect_success "start up iptb nodes" '
25 - iptb start
25 + iptb start -wait
26 '
27
28 test_expect_success "check peers works" '
@@ -38,11 +38,11 @@ betterwait() {
38 }
39
40 test_expect_success "bring down iptb nodes" '
41 - PID0=$(cat "$IPTB_ROOT/0/daemon.pid") &&
42 - PID1=$(cat "$IPTB_ROOT/1/daemon.pid") &&
43 - PID2=$(cat "$IPTB_ROOT/2/daemon.pid") &&
44 - PID3=$(cat "$IPTB_ROOT/3/daemon.pid") &&
45 - PID4=$(cat "$IPTB_ROOT/4/daemon.pid") &&
41 + PID0=$(cat "$IPTB_ROOT/benches/default/0/daemon.pid") &&
42 + PID1=$(cat "$IPTB_ROOT/benches/default/1/daemon.pid") &&
43 + PID2=$(cat "$IPTB_ROOT/benches/default/2/daemon.pid") &&
44 + PID3=$(cat "$IPTB_ROOT/benches/default/3/daemon.pid") &&
45 + PID4=$(cat "$IPTB_ROOT/benches/default/4/daemon.pid") &&
46 iptb stop && # TODO: add --wait flag to iptb stop
47 betterwait $PID0
48 betterwait $PID1
@@ -53,7 +53,7 @@ test_expect_success "bring down iptb nodes" '
53
54 test_expect_success "reset iptb nodes" '
55 # the api doesnt seem to get cleaned up in sharness tests for some reason
56 - iptb init -n 5 -f --bootstrap=none --port=0
56 + iptb testbed create -type localipfs -count 5 -force -init
57 '
58
59 test_expect_success "set bootstrap addrs" '
@@ -67,7 +67,7 @@ test_expect_success "set bootstrap addrs" '
67 '
68
69 test_expect_success "start up iptb nodes" '
70 - iptb start --wait
70 + iptb start -wait
71 '
72
73 test_expect_success "check peers works" '
test/sharness/t0125-twonode.sh
+1 -1
@@ -86,7 +86,7 @@ run_advanced_test() {
86 }
87
88 test_expect_success "set up tcp testbed" '
89 - iptb init -n 2 -p 0 -f --bootstrap=none
89 + iptb testbed create -type localipfs -count 2 -force -init
90 '
91
92 # Enable quic but don't use it yet.
test/sharness/t0130-multinode.sh
+3 -3
@@ -80,12 +80,12 @@ run_advanced_test() {
80
81 test_expect_success "shut down nodes" '
82 iptb stop && iptb_wait_stop ||
83 - test_fsh tail -n +1 .iptb/*/daemon.std*
83 + test_fsh tail -n +1 .iptb/benches/default/*/daemon.std*
84 '
85 }
86
87 test_expect_success "set up /tcp testbed" '
88 - iptb init -n 5 -p 0 -f --bootstrap=none
88 + iptb testbed create -type localipfs -count 5 -force -init
89 '
90
91 # test multiplex muxer
@@ -97,7 +97,7 @@ unset LIBP2P_MUX_PREFS
97 run_advanced_test
98
99 test_expect_success "set up /ws testbed" '
100 - iptb init -n 5 -ws -p 0 -f --bootstrap=none
100 + iptb testbed create -type localipfs -count 5 -attr listentype,ws -force -init
101 '
102
103 # test multiplex muxer
test/sharness/t0131-multinode-client-routing.sh
+3 -3
@@ -43,12 +43,12 @@ run_single_file_test() {
43 NNODES=10
44
45 test_expect_success "set up testbed" '
46 - iptb init -n $NNODES -p 0 -f --bootstrap=none
46 + iptb testbed create -type localipfs -count $NNODES -force -init
47 '
48
49 test_expect_success "start up nodes" '
50 - iptb start [0-7] &&
51 - iptb start [8-9] --args="--routing=dhtclient"
50 + iptb start -wait [0-7] &&
51 + iptb start -wait [8-9] -- --routing=dhtclient
52 '
53
54 test_expect_success "connect up nodes" '
test/sharness/t0140-swarm.sh
+5 -5
@@ -98,28 +98,28 @@ test_expect_success "Addresses.NoAnnounce with /ipcidr affects addresses" '
98 test_kill_ipfs_daemon
99
100 test_expect_success "set up tcp testbed" '
101 - iptb init -n 2 -p 0 -f --bootstrap=none
101 + iptb testbed create -type localipfs -count 2 -force -init
102 '
103
104 startup_cluster 2
105
106 test_expect_success "disconnect work without specifying a transport address" '
107 [ $(ipfsi 0 swarm peers | wc -l) -eq 1 ] &&
108 - ipfsi 0 swarm disconnect "/ipfs/$(iptb get id 1)" &&
108 + ipfsi 0 swarm disconnect "/ipfs/$(iptb attr get 1 id)" &&
109 [ $(ipfsi 0 swarm peers | wc -l) -eq 0 ]
110 '
111
112 test_expect_success "connect work without specifying a transport address" '
113 [ $(ipfsi 0 swarm peers | wc -l) -eq 0 ] &&
114 - ipfsi 0 swarm connect "/ipfs/$(iptb get id 1)" &&
114 + ipfsi 0 swarm connect "/ipfs/$(iptb attr get 1 id)" &&
115 [ $(ipfsi 0 swarm peers | wc -l) -eq 1 ]
116 '
117
118 test_expect_success "/p2p addresses work" '
119 [ $(ipfsi 0 swarm peers | wc -l) -eq 1 ] &&
120 - ipfsi 0 swarm disconnect "/p2p/$(iptb get id 1)" &&
120 + ipfsi 0 swarm disconnect "/p2p/$(iptb attr get 1 id)" &&
121 [ $(ipfsi 0 swarm peers | wc -l) -eq 0 ] &&
122 - ipfsi 0 swarm connect "/p2p/$(iptb get id 1)" &&
122 + ipfsi 0 swarm connect "/p2p/$(iptb attr get 1 id)" &&
123 [ $(ipfsi 0 swarm peers | wc -l) -eq 1 ]
124 '
125
test/sharness/t0170-dht.sh
+5 -5
@@ -12,14 +12,14 @@ test_dht() {
12
13 test_expect_success 'init iptb' '
14 rm -rf .iptb/ &&
15 - iptb init -n $NUM_NODES --bootstrap=none --port=0
15 + iptb testbed create -type localipfs -count $NUM_NODES -init
16 '
17
18 - startup_cluster $NUM_NODES "$@"
18 + startup_cluster $NUM_NODES $@
19
20 test_expect_success 'peer ids' '
21 - PEERID_0=$(iptb get id 0) &&
22 - PEERID_2=$(iptb get id 2)
21 + PEERID_0=$(iptb attr get 0 id) &&
22 + PEERID_2=$(iptb attr get 2 id)
23 '
24
25 # ipfs dht findpeer <peerID>
@@ -70,7 +70,7 @@ test_dht() {
70 # ipfs dht findprovs <key>
71 test_expect_success 'findprovs' '
72 ipfsi 4 dht findprovs $HASH > provs &&
73 - iptb get id 3 > expected &&
73 + iptb attr get 3 id > expected &&
74 test_cmp provs expected
75 '
76
test/sharness/t0175-reprovider.sh
+6 -6
@@ -8,12 +8,12 @@ NUM_NODES=6
8
9 init_strategy() {
10 test_expect_success 'init iptb' '
11 - iptb init -f -n $NUM_NODES --bootstrap=none --port=0
11 + iptb testbed create -type localipfs -force -count $NUM_NODES -init
12 '
13
14 test_expect_success 'peer ids' '
15 - PEERID_0=$(iptb get id 0) &&
16 - PEERID_1=$(iptb get id 1)
15 + PEERID_0=$(iptb attr get 0 id) &&
16 + PEERID_1=$(iptb attr get 1 id)
17 '
18
19 test_expect_success 'use pinning startegy for reprovider' '
@@ -123,12 +123,12 @@ test_expect_success 'stop peer 1' '
123
124 # Test reprovider working with ticking disabled
125 test_expect_success 'init iptb' '
126 - iptb init -f -n $NUM_NODES --bootstrap=none --port=0
126 + iptb testbed create -type localipfs -force -count $NUM_NODES -init
127 '
128
129 test_expect_success 'peer ids' '
130 - PEERID_0=$(iptb get id 0) &&
131 - PEERID_1=$(iptb get id 1)
130 + PEERID_0=$(iptb attr get 0 id) &&
131 + PEERID_1=$(iptb attr get 1 id)
132 '
133
134 test_expect_success 'Disable reprovider ticking' '
test/sharness/t0180-p2p.sh
+3 -3
@@ -6,7 +6,7 @@ test_description="Test experimental p2p commands"
6
7 # start iptb + wait for peering
8 test_expect_success 'init iptb' '
9 - iptb init -n 3 --bootstrap=none --port=0
9 + iptb testbed create -type localipfs --count 3 --init
10 '
11
12 test_expect_success 'generate test data' '
@@ -17,8 +17,8 @@ test_expect_success 'generate test data' '
17 startup_cluster 3
18
19 test_expect_success 'peer ids' '
20 - PEERID_0=$(iptb get id 0) &&
21 - PEERID_1=$(iptb get id 1)
20 + PEERID_0=$(iptb attr get 0 id) &&
21 + PEERID_1=$(iptb attr get 1 id)
22 '
23 check_test_ports() {
24 test_expect_success "test ports are closed" '
test/sharness/t0180-pubsub-gossipsub.sh
+3 -3
@@ -7,7 +7,7 @@ test_description="Test pubsub with gossipsub"
7 # start iptb + wait for peering
8 NUM_NODES=5
9 test_expect_success 'init iptb' '
10 - iptb init -n $NUM_NODES --bootstrap=none --port=0
10 + iptb testbed create -type localipfs -count $NUM_NODES -init
11 '
12
13 test_expect_success "enable gossipsub" '
@@ -20,8 +20,8 @@ test_expect_success "enable gossipsub" '
20 startup_cluster $NUM_NODES --enable-pubsub-experiment
21
22 test_expect_success 'peer ids' '
23 - PEERID_0=$(iptb get id 0) &&
24 - PEERID_2=$(iptb get id 2)
23 + PEERID_0=$(iptb attr get 0 id) &&
24 + PEERID_2=$(iptb attr get 2 id)
25 '
26
27 test_expect_success 'pubsub' '
test/sharness/t0180-pubsub.sh
+3 -3
@@ -7,13 +7,13 @@ test_description="Test dht command"
7 # start iptb + wait for peering
8 NUM_NODES=5
9 test_expect_success 'init iptb' '
10 - iptb init -n $NUM_NODES --bootstrap=none --port=0
10 + iptb testbed create -type localipfs -count $NUM_NODES -init
11 '
12
13 run_pubsub_tests() {
14 test_expect_success 'peer ids' '
15 - PEERID_0=$(iptb get id 0) &&
16 - PEERID_2=$(iptb get id 2)
15 + PEERID_0=$(iptb attr get 0 id) &&
16 + PEERID_2=$(iptb attr get 2 id)
17 '
18
19 # ipfs pubsub sub
test/sharness/t0181-private-network.sh
+4 -4
@@ -34,15 +34,15 @@ pnet_key > "${IPFS_PATH}/swarm.key"
34 LIBP2P_FORCE_PNET=1 test_launch_ipfs_daemon
35
36 test_expect_success "set up iptb testbed" '
37 - iptb init -n 5 -p 0 -f --bootstrap=none &&
38 - iptb for-each ipfs config --json Addresses.Swarm '"'"'["/ip4/127.0.0.1/tcp/0"]'"'"'
37 + iptb testbed create -type localipfs -count 5 -force -init &&
38 + iptb run -- ipfs config --json Addresses.Swarm '"'"'["/ip4/127.0.0.1/tcp/0"]'"'"'
39 '
40
41 set_key() {
42 node="$1"
43 keyfile="$2"
44
45 - cp "$keyfile" "${IPTB_ROOT}/${node}/swarm.key"
45 + cp "$keyfile" "${IPTB_ROOT}/testbeds/default/${node}/swarm.key"
46 }
47
48 pnet_key > key1
@@ -57,7 +57,7 @@ set_key 4 key2
57 unset LIBP2P_FORCE_PNET
58
59 test_expect_success "start nodes" '
60 - iptb start [0-4]
60 + iptb start -wait [0-4]
61 '
62
63 test_expect_success "try connecting node in public network with priv networks" '
test/sharness/t0182-circuit-relay.sh
+6 -6
@@ -7,12 +7,12 @@ test_description="Test circuit relay"
7 # start iptb + wait for peering
8 NUM_NODES=3
9 test_expect_success 'init iptb' '
10 - iptb init -n $NUM_NODES --bootstrap=none --port=0
10 + iptb testbed create -type localipfs -count $NUM_NODES -init
11 '
12
13 # Network toplogy: A <-> Relay <-> B
14 test_expect_success 'start up nodes for configuration' '
15 - iptb start --args --routing=none
15 + iptb start -wait -- --routing=none
16 '
17
18 test_expect_success 'configure EnableRelayHop in relay node' '
@@ -22,7 +22,7 @@ test_expect_success 'configure EnableRelayHop in relay node' '
22 test_expect_success 'restart nodes' '
23 iptb stop &&
24 iptb_wait_stop &&
25 - iptb start --args --routing=none
25 + iptb start -wait -- --routing=none
26 '
27
28 test_expect_success 'connect A <-> Relay' '
@@ -38,9 +38,9 @@ test_expect_success 'wait until relay is ready to do work' '
38 '
39
40 test_expect_success 'peer ids' '
41 - PEERID_0=$(iptb get id 0) &&
42 - PEERID_1=$(iptb get id 1) &&
43 - PEERID_2=$(iptb get id 2)
41 + PEERID_0=$(iptb attr get 0 id) &&
42 + PEERID_1=$(iptb attr get 1 id) &&
43 + PEERID_2=$(iptb attr get 2 id)
44 '
45
46 test_expect_success 'connect A <-Relay-> B' '
test/sharness/t0183-namesys-pubsub.sh
+2 -2
@@ -7,13 +7,13 @@ test_description="Test IPNS pubsub"
7 # start iptb + wait for peering
8 NUM_NODES=5
9 test_expect_success 'init iptb' '
10 - iptb init -n $NUM_NODES --bootstrap=none --port=0
10 + iptb testbed create -type localipfs -count $NUM_NODES -init
11 '
12
13 startup_cluster $NUM_NODES --enable-namesys-pubsub
14
15 test_expect_success 'peer ids' '
16 - PEERID_0=$(iptb get id 0)
16 + PEERID_0=$(iptb attr get 0 id)
17 '
18
19 test_expect_success 'check namesys pubsub state' '
test/sharness/t0190-quic-ping.sh
+3 -3
@@ -8,7 +8,7 @@ test_init_ipfs
8
9 # start iptb + wait for peering
10 test_expect_success 'init iptb' '
11 - iptb init -n 2 --bootstrap=none --port=0
11 + iptb testbed create -type localipfs -count 2 -init
12 '
13
14 test_expect_success "enable QUIC experiment" '
@@ -26,8 +26,8 @@ test_expect_success "add QUIC swarm addresses" '
26 startup_cluster 2
27
28 test_expect_success 'peer ids' '
29 - PEERID_0=$(iptb get id 0) &&
30 - PEERID_1=$(iptb get id 1)
29 + PEERID_0=$(iptb attr get 0 id) &&
30 + PEERID_1=$(iptb attr get 1 id)
31 '
32
33 test_expect_success "test ping other" '
test/sharness/t0240-republisher.sh
+2 -2
@@ -15,7 +15,7 @@ setup_iptb() {
15 bound=$(expr "$num_nodes" - 1)
16
17 test_expect_success "iptb init" '
18 - iptb init -n $num_nodes --bootstrap none --port 0
18 + iptb testbed create -type localipfs -count $num_nodes -init
19 '
20
21 for i in $(test_seq 0 "$bound")
@@ -31,7 +31,7 @@ setup_iptb() {
31
32 teardown_iptb() {
33 test_expect_success "shut down nodes" '
34 - iptb kill
34 + iptb stop
35 '
36 }
37
test/sharness/t0276-cidv0v1.sh
+7 -6
@@ -95,30 +95,31 @@ test_expect_success "check that we can access the file when converted to CIDv1"
95 #
96
97 test_expect_success "set up iptb testbed" '
98 - iptb init -n 2 -p 0 -f --bootstrap=none
98 + iptb testbed create -type localipfs -count 2 -init
99 '
100
101 test_expect_success "start nodes" '
102 - iptb start &&
102 + iptb start -wait &&
103 iptb connect 0 1
104 '
105
106 test_expect_success "add afile using CIDv0 to node 0" '
107 - iptb run 0 ipfs add -q --cid-version=0 afile
107 + iptb run 0 -- ipfs add -q --cid-version=0 afile
108 '
109
110 test_expect_success "get afile using CIDv1 via node 1" '
111 - iptb run 1 ipfs --timeout=2s cat $AHASHv1 > thefile &&
111 + iptb run -raw 1 -- ipfs --timeout=2s cat $AHASHv1 > thefile &&
112 test_cmp afile thefile
113 '
114
115 test_expect_success "add bfile using CIDv1 to node 0" '
116 - BHASHv1=$(iptb run 0 ipfs add -q --cid-version=1 --raw-leaves=false bfile)
116 + BHASHv1=$(iptb run -raw 0 -- ipfs add -q --cid-version=1 --raw-leaves=false bfile)
117 '
118
119 test_expect_success "get bfile using CIDv0 via node 1" '
120 BHASHv0=$(cid-fmt -v 0 %s $BHASHv1)
121 - iptb run 1 ipfs --timeout=2s cat $BHASHv0 > thefile &&
121 + echo $BHASHv1 &&
122 + iptb run -raw 1 -- ipfs --timeout=2s cat $BHASHv0 > thefile &&
123 test_cmp bfile thefile
124 '
125