Skip to content

Commit

Permalink
test(sharness): fix tests for /ipfs -> /p2p change
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Dec 14, 2019
1 parent 15c35a5 commit ff8e4fc
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion test/3nodetest/client/run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ipfs bootstrap add /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_TCP_PORT/ipfs/QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE
ipfs bootstrap add /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_TCP_PORT/p2p/QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE
ipfs bootstrap # list bootstrap nodes for debugging

echo "3nodetest> starting client daemon"
Expand Down
4 changes: 2 additions & 2 deletions test/3nodetest/server/run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# must be connected to bootstrap node
ipfs bootstrap add /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_TCP_PORT/ipfs/QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE
ipfs bootstrap add /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_TCP_PORT/p2p/QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE
ipfs bootstrap # list bootstrap nodes for debugging

# wait for daemon to start/bootstrap
Expand All @@ -9,7 +9,7 @@ echo "3nodetest> starting server daemon"
# run daemon in debug mode to collect profiling data
ipfs daemon --debug &
sleep 3
# TODO instead of bootrapping: ipfs swarm connect /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_TCP_PORT/ipfs/QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE
# TODO instead of bootrapping: ipfs swarm connect /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_TCP_PORT/p2p/QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE

# change dir before running add commands so ipfs client profiling data doesn't
# overwrite the daemon profiling data
Expand Down
2 changes: 1 addition & 1 deletion test/sharness/lib/iptb-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ipfsi() {
check_has_connection() {
node="$1"
ipfsi "$node" swarm peers >"swarm_peers_$node" &&
grep "ipfs" "swarm_peers_$node" >/dev/null
grep "p2p" "swarm_peers_$node" >/dev/null
}

iptb() {
Expand Down
26 changes: 13 additions & 13 deletions test/sharness/t0120-bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
#

# changing the bootstrap peers will require changing it in two places :)
BP1="/dnsaddr/bootstrap.libp2p.io/ipfs/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN"
BP2="/dnsaddr/bootstrap.libp2p.io/ipfs/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa"
BP3="/dnsaddr/bootstrap.libp2p.io/ipfs/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb"
BP4="/dnsaddr/bootstrap.libp2p.io/ipfs/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt"
BP5="/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
BP6="/ip4/104.236.179.241/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM"
BP7="/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64"
BP8="/ip4/128.199.219.111/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu"
BP9="/ip4/178.62.158.247/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd"
BP10="/ip6/2400:6180:0:d0::151:6001/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu"
BP11="/ip6/2604:a880:1:20::203:d001/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM"
BP12="/ip6/2604:a880:800:10::4a:5001/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64"
BP13="/ip6/2a03:b0c0:0:1010::23:1001/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd"
BP1="/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN"
BP2="/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa"
BP3="/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb"
BP4="/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt"
BP5="/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
BP6="/ip4/104.236.179.241/tcp/4001/p2p/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM"
BP7="/ip4/104.236.76.40/tcp/4001/p2p/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64"
BP8="/ip4/128.199.219.111/tcp/4001/p2p/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu"
BP9="/ip4/178.62.158.247/tcp/4001/p2p/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd"
BP10="/ip6/2400:6180:0:d0::151:6001/tcp/4001/p2p/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu"
BP11="/ip6/2604:a880:1:20::203:d001/tcp/4001/p2p/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM"
BP12="/ip6/2604:a880:800:10::4a:5001/tcp/4001/p2p/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64"
BP13="/ip6/2a03:b0c0:0:1010::23:1001/tcp/4001/p2p/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd"

test_description="Test ipfs repo operations"

Expand Down
2 changes: 1 addition & 1 deletion test/sharness/t0121-bootstrap-iptb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ test_expect_success "reset iptb nodes" '

test_expect_success "set bootstrap addrs" '
bsn_peer_id=$(ipfs id -f "<id>") &&
BADDR="/ip4/127.0.0.1/tcp/$SWARM_PORT/ipfs/$bsn_peer_id" &&
BADDR="/ip4/127.0.0.1/tcp/$SWARM_PORT/p2p/$bsn_peer_id" &&
ipfsi 0 bootstrap add $BADDR &&
ipfsi 1 bootstrap add $BADDR &&
ipfsi 2 bootstrap add $BADDR &&
Expand Down
6 changes: 3 additions & 3 deletions test/sharness/t0140-swarm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test_expect_success "output looks good" '
grep PublicKey output
'

addr="/ip4/127.0.0.1/tcp/9898/ipfs/QmUWKoHbjsqsSMesRC2Zoscs8edyFz6F77auBB1YBBhgpX"
addr="/ip4/127.0.0.1/tcp/9898/p2p/QmUWKoHbjsqsSMesRC2Zoscs8edyFz6F77auBB1YBBhgpX"

test_expect_success "cant trigger a dial backoff with swarm connect" '
test_expect_code 1 ipfs swarm connect $addr 2> connect_out
Expand Down Expand Up @@ -105,13 +105,13 @@ startup_cluster 2

test_expect_success "disconnect work without specifying a transport address" '
[ $(ipfsi 0 swarm peers | wc -l) -eq 1 ] &&
ipfsi 0 swarm disconnect "/ipfs/$(iptb attr get 1 id)" &&
ipfsi 0 swarm disconnect "/p2p/$(iptb attr get 1 id)" &&
[ $(ipfsi 0 swarm peers | wc -l) -eq 0 ]
'

test_expect_success "connect work without specifying a transport address" '
[ $(ipfsi 0 swarm peers | wc -l) -eq 0 ] &&
ipfsi 0 swarm connect "/ipfs/$(iptb attr get 1 id)" &&
ipfsi 0 swarm connect "/p2p/$(iptb attr get 1 id)" &&
[ $(ipfsi 0 swarm peers | wc -l) -eq 1 ]
'

Expand Down
32 changes: 16 additions & 16 deletions test/sharness/t0180-p2p.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ test_server_to_client() {

spawn_sending_server

test_expect_success 'S->C(/ipfs/peerID) Setup client side' '
ipfsi 1 p2p forward /x/p2p-test /ip4/127.0.0.1/tcp/10102 /ipfs/${PEERID_0} 2>&1 > dialer-stdouterr.log
test_expect_success 'S->C(/p2p/peerID) Setup client side' '
ipfsi 1 p2p forward /x/p2p-test /ip4/127.0.0.1/tcp/10102 /p2p/${PEERID_0} 2>&1 > dialer-stdouterr.log
'

test_expect_success 'S->C Setup(dnsaddr/addr/ipfs/peerID) client side' '
ipfsi 1 p2p forward /x/p2p-test /ip4/127.0.0.1/tcp/10103 /dnsaddr/bootstrap.libp2p.io/ipfs/${PEERID_0} 2>&1 > dialer-stdouterr.log
test_expect_success 'S->C Setup(dnsaddr/addr/p2p/peerID) client side' '
ipfsi 1 p2p forward /x/p2p-test /ip4/127.0.0.1/tcp/10103 /dnsaddr/bootstrap.libp2p.io/p2p/${PEERID_0} 2>&1 > dialer-stdouterr.log
'

test_expect_success 'S->C Setup(dnsaddr/addr) client side' '
Expand Down Expand Up @@ -126,7 +126,7 @@ test_expect_success 'C->S Spawn receiving server' '
'

test_expect_success 'C->S Setup client side' '
ipfsi 1 p2p forward /x/p2p-test /ip4/127.0.0.1/tcp/10102 /ipfs/${PEERID_0} 2>&1 > dialer-stdouterr.log
ipfsi 1 p2p forward /x/p2p-test /ip4/127.0.0.1/tcp/10102 /p2p/${PEERID_0} 2>&1 > dialer-stdouterr.log
'

test_expect_success 'C->S Connect and receive data' '
Expand Down Expand Up @@ -155,7 +155,7 @@ test_expect_success "cannot accept 0 port in 'ipfs p2p listen'" '
'

test_expect_success "'ipfs p2p forward' accept 0 port" '
ipfsi 2 p2p forward /x/p2p-test/0 /ip4/127.0.0.1/tcp/0 /ipfs/$PEERID_0
ipfsi 2 p2p forward /x/p2p-test/0 /ip4/127.0.0.1/tcp/0 /p2p/$PEERID_0
'

test_expect_success "'ipfs p2p ls' output looks good" '
Expand All @@ -168,7 +168,7 @@ test_expect_success "'ipfs p2p ls' output looks good" '
# Listing streams

test_expect_success "'ipfs p2p ls' succeeds" '
echo "/x/p2p-test /ipfs/$PEERID_0 /ip4/127.0.0.1/tcp/10101" > expected &&
echo "/x/p2p-test /p2p/$PEERID_0 /ip4/127.0.0.1/tcp/10101" > expected &&
ipfsi 0 p2p ls > actual
'

Expand All @@ -190,7 +190,7 @@ check_test_ports
test_expect_success "Setup: Idle stream" '
ma-pipe-unidir --listen --pidFile=listener.pid recv /ip4/127.0.0.1/tcp/10101 &
ipfsi 1 p2p forward /x/p2p-test /ip4/127.0.0.1/tcp/10102 /ipfs/$PEERID_0 &&
ipfsi 1 p2p forward /x/p2p-test /ip4/127.0.0.1/tcp/10102 /p2p/$PEERID_0 &&
ma-pipe-unidir --pidFile=client.pid recv /ip4/127.0.0.1/tcp/10102 &
test_wait_for_file 30 100ms listener.pid &&
Expand All @@ -199,7 +199,7 @@ test_expect_success "Setup: Idle stream" '
'

test_expect_success "'ipfs p2p stream ls' succeeds" '
echo "3 /x/p2p-test /ipfs/$PEERID_1 /ip4/127.0.0.1/tcp/10101" > expected
echo "3 /x/p2p-test /p2p/$PEERID_1 /ip4/127.0.0.1/tcp/10101" > expected
ipfsi 0 p2p stream ls > actual
'

Expand Down Expand Up @@ -232,7 +232,7 @@ test_expect_success "Setup: Idle stream(2)" '
ma-pipe-unidir --listen --pidFile=listener.pid recv /ip4/127.0.0.1/tcp/10101 &
ipfsi 0 p2p listen /x/p2p-test2 /ip4/127.0.0.1/tcp/10101 2>&1 > listener-stdouterr.log &&
ipfsi 1 p2p forward /x/p2p-test2 /ip4/127.0.0.1/tcp/10102 /ipfs/$PEERID_0 2>&1 > dialer-stdouterr.log &&
ipfsi 1 p2p forward /x/p2p-test2 /ip4/127.0.0.1/tcp/10102 /p2p/$PEERID_0 2>&1 > dialer-stdouterr.log &&
ma-pipe-unidir --pidFile=client.pid recv /ip4/127.0.0.1/tcp/10102 &
test_wait_for_file 30 100ms listener.pid &&
Expand All @@ -241,7 +241,7 @@ test_expect_success "Setup: Idle stream(2)" '
'

test_expect_success "'ipfs p2p stream ls' succeeds(2)" '
echo "4 /x/p2p-test2 /ipfs/$PEERID_1 /ip4/127.0.0.1/tcp/10101" > expected
echo "4 /x/p2p-test2 /p2p/$PEERID_1 /ip4/127.0.0.1/tcp/10101" > expected
ipfsi 0 p2p stream ls > actual
test_cmp expected actual
'
Expand Down Expand Up @@ -283,8 +283,8 @@ test_expect_success "'ipfs p2p close' closes by target addr" '

test_expect_success "'ipfs p2p close' closes right listeners" '
ipfsi 0 p2p listen /x/p2p-test /ip4/127.0.0.1/tcp/10101 &&
ipfsi 0 p2p forward /x/p2p-test /ip4/127.0.0.1/tcp/10101 /ipfs/$PEERID_1 &&
echo "/x/p2p-test /ipfs/$PEERID_0 /ip4/127.0.0.1/tcp/10101" > expected &&
ipfsi 0 p2p forward /x/p2p-test /ip4/127.0.0.1/tcp/10101 /p2p/$PEERID_1 &&
echo "/x/p2p-test /p2p/$PEERID_0 /ip4/127.0.0.1/tcp/10101" > expected &&
ipfsi 0 p2p close -l /ip4/127.0.0.1/tcp/10101 &&
ipfsi 0 p2p ls > actual &&
Expand All @@ -294,7 +294,7 @@ test_expect_success "'ipfs p2p close' closes right listeners" '
check_test_ports

test_expect_success "'ipfs p2p close' closes by listen addr" '
ipfsi 0 p2p close -l /ipfs/$PEERID_0 &&
ipfsi 0 p2p close -l /p2p/$PEERID_0 &&
ipfsi 0 p2p ls > actual &&
test_must_be_empty actual
'
Expand All @@ -313,7 +313,7 @@ test_expect_success 'C->S Spawn receiving server' '
'

test_expect_success 'C->S Setup client side' '
ipfsi 1 p2p forward /x/p2p-test /ip4/127.0.0.1/tcp/10102 /ipfs/${PEERID_0} 2>&1 > dialer-stdouterr.log
ipfsi 1 p2p forward /x/p2p-test /ip4/127.0.0.1/tcp/10102 /p2p/${PEERID_0} 2>&1 > dialer-stdouterr.log
'

test_expect_success 'C->S Connect and receive data' '
Expand Down Expand Up @@ -358,7 +358,7 @@ test_expect_success 'start p2p listener on custom proto' '
spawn_sending_server

test_expect_success 'S->C Setup client side (custom proto)' '
ipfsi 1 p2p forward --allow-custom-protocol /p2p-test /ip4/127.0.0.1/tcp/10102 /ipfs/${PEERID_0} 2>&1 > dialer-stdouterr.log
ipfsi 1 p2p forward --allow-custom-protocol /p2p-test /ip4/127.0.0.1/tcp/10102 /p2p/${PEERID_0} 2>&1 > dialer-stdouterr.log
'

test_server_to_client
Expand Down
6 changes: 3 additions & 3 deletions test/sharness/t0182-circuit-relay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ test_expect_success 'peer ids' '
'

test_expect_success 'connect A <-Relay-> B' '
ipfsi 0 swarm connect /p2p-circuit/ipfs/$PEERID_2 > peers_out
ipfsi 0 swarm connect /p2p-circuit/p2p/$PEERID_2 > peers_out
'

test_expect_success 'output looks good' '
Expand All @@ -54,12 +54,12 @@ test_expect_success 'output looks good' '

test_expect_success 'peers for A look good' '
ipfsi 0 swarm peers > peers_out &&
test_should_contain "/ipfs/$PEERID_1/p2p-circuit/ipfs/$PEERID_2$" peers_out
test_should_contain "/p2p/$PEERID_1/p2p-circuit/p2p/$PEERID_2$" peers_out
'

test_expect_success 'peers for B look good' '
ipfsi 2 swarm peers > peers_out &&
test_should_contain "/ipfs/$PEERID_1/p2p-circuit/ipfs/$PEERID_0$" peers_out
test_should_contain "/p2p/$PEERID_1/p2p-circuit/p2p/$PEERID_0$" peers_out
'

test_expect_success 'add an object in A' '
Expand Down

0 comments on commit ff8e4fc

Please sign in to comment.