@cryptotaxi247 / kubo / commits / ac551f1df

ping: add sharness tests

License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>

Steven Allen committed Jan 4, 2018 at 10:45 UTC ac551f1dfd9103a1f1d4802fe33d00f62a33c65c
1 file changed +37
test/sharness/t0041-ping.sh new
+37
@@ -0,0 +1,37 @@
1 +#!/bin/sh
2 +
3 +test_description="Test ping command"
4 +
5 +. lib/test-lib.sh
6 +
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
12 +'
13 +
14 +startup_cluster 2
15 +
16 +test_expect_success 'peer ids' '
17 + PEERID_0=$(iptb get id 0) &&
18 + PEERID_1=$(iptb get id 1)
19 +'
20 +
21 +test_expect_success "test ping other" '
22 + ipfsi 0 ping -n2 -- "$PEERID_1" && ipfsi 1 ping -n2 -- "$PEERID_0"
23 +'
24 +
25 +test_expect_success "test ping self" '
26 + ! ipfsi 0 ping -n2 -- "$PEERID_0" && ! ipfsi 1 ping -n2 -- "$PEERID_1"
27 +'
28 +
29 +test_expect_success "test ping 0" '
30 + ! ipfsi 0 ping -n0 -- "$PEERID_1" && ! ipfsi 1 ping -n0 -- "$PEERID_0"
31 +'
32 +
33 +test_expect_success 'stop iptb' '
34 + iptb stop
35 +'
36 +
37 +test_done