@@ -6,15 +6,15 @@ test_description="Test experimental p2p commands"
6
6
7
7
# start iptb + wait for peering
8
8
test_expect_success ' init iptb' '
9
- iptb init -n 2 --bootstrap=none --port=0
9
+ iptb init -n 3 --bootstrap=none --port=0
10
10
'
11
11
12
12
test_expect_success ' generate test data' '
13
13
echo "ABCDEF" > test0.bin &&
14
14
echo "012345" > test1.bin
15
15
'
16
16
17
- startup_cluster 2
17
+ startup_cluster 3
18
18
19
19
test_expect_success ' peer ids' '
20
20
PEERID_0=$(iptb get id 0) &&
@@ -36,6 +36,7 @@ test_expect_success 'fail without config option being enabled' '
36
36
test_expect_success " enable filestore config setting" '
37
37
ipfsi 0 config --json Experimental.Libp2pStreamMounting true
38
38
ipfsi 1 config --json Experimental.Libp2pStreamMounting true
39
+ ipfsi 2 config --json Experimental.Libp2pStreamMounting true
39
40
'
40
41
41
42
test_expect_success ' start p2p listener' '
@@ -129,6 +130,23 @@ test_expect_success 'C->S Close local listener' '
129
130
130
131
check_test_ports
131
132
133
+ # Checking port
134
+
135
+ test_expect_success " cannot accept 0 port in 'ipfs p2p listen'" '
136
+ test_must_fail ipfsi 0 p2p listen /x/p2p-test/0 /ip4/127.0.0.1/tcp/0
137
+ '
138
+
139
+ test_expect_success " 'ipfs p2p forward' accept 0 port" '
140
+ ipfsi 2 p2p forward /x/p2p-test/0 /ip4/127.0.0.1/tcp/0 /ipfs/$PEERID_0
141
+ '
142
+
143
+ test_expect_success " 'ipfs p2p ls' output looks good" '
144
+ echo "true" > forward_0_expected &&
145
+ ipfsi 2 p2p ls | awk ' \' ' {print $2}' \' ' | sed "s/.*\///" | awk -F: ' \' ' {if($1>0)print"true"}' \' ' > forward_0_actual
146
+ ipfsi 2 p2p close -p /x/p2p-test/0
147
+ test_cmp forward_0_expected forward_0_actual
148
+ '
149
+
132
150
# Listing streams
133
151
134
152
test_expect_success " 'ipfs p2p ls' succeeds" '
0 commit comments