sharness: verify that we return an error when we can't lookup a peer in ping
License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
Steven Allen committed
Oct 30, 2018 at 06:31 UTC
62240f347a109d8cb7d7028c59f0993cf51fe145
1 file changed
+9
test/sharness/t0041-ping.sh
+9
@@ -6,6 +6,8 @@ test_description="Test ping command"
6
7
test_init_ipfs
8
9
+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
@@ -23,6 +25,13 @@ test_expect_success "test ping other" '
25
ipfsi 1 ping -n2 -- "$PEERID_0"
26
'
27
28
+test_expect_success "test ping unreachable peer" '
29
+ printf "Looking up peer %s\n" "$BAD_PEER" > bad_ping_exp &&
30
+ printf "Peer lookup error: routing: not found\n" >> bad_ping_exp &&
31
+ ipfsi 0 ping -n2 -- "$BAD_PEER" > bad_ping_actual &&
32
+ test_cmp bad_ping_exp bad_ping_actual
33
+'
34
+
35
test_expect_success "test ping self" '
36
! ipfsi 0 ping -n2 -- "$PEERID_0" &&
37
! ipfsi 1 ping -n2 -- "$PEERID_1"