Skip to content

Commit

Permalink
sharness: verify that we return an error when we can't lookup a peer …
Browse files Browse the repository at this point in the history
…in ping

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
  • Loading branch information
Stebalien committed Oct 30, 2018
1 parent b8f5355 commit 62240f3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/sharness/t0041-ping.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ test_description="Test ping command"

test_init_ipfs

BAD_PEER="QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJx"

# start iptb + wait for peering
test_expect_success 'init iptb' '
iptb init -n 2 --bootstrap=none --port=0
Expand All @@ -23,6 +25,13 @@ test_expect_success "test ping other" '
ipfsi 1 ping -n2 -- "$PEERID_0"
'

test_expect_success "test ping unreachable peer" '
printf "Looking up peer %s\n" "$BAD_PEER" > bad_ping_exp &&
printf "Peer lookup error: routing: not found\n" >> bad_ping_exp &&
ipfsi 0 ping -n2 -- "$BAD_PEER" > bad_ping_actual &&
test_cmp bad_ping_exp bad_ping_actual
'

test_expect_success "test ping self" '
! ipfsi 0 ping -n2 -- "$PEERID_0" &&
! ipfsi 1 ping -n2 -- "$PEERID_1"
Expand Down

0 comments on commit 62240f3

Please # to comment.