mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 19:24:14 +08:00
ping: add sharness tests
License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
This commit is contained in:
37
test/sharness/t0041-ping.sh
Executable file
37
test/sharness/t0041-ping.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
|
||||
test_description="Test ping command"
|
||||
|
||||
. lib/test-lib.sh
|
||||
|
||||
test_init_ipfs
|
||||
|
||||
# start iptb + wait for peering
|
||||
test_expect_success 'init iptb' '
|
||||
iptb init -n 2 --bootstrap=none --port=0
|
||||
'
|
||||
|
||||
startup_cluster 2
|
||||
|
||||
test_expect_success 'peer ids' '
|
||||
PEERID_0=$(iptb get id 0) &&
|
||||
PEERID_1=$(iptb get id 1)
|
||||
'
|
||||
|
||||
test_expect_success "test ping other" '
|
||||
ipfsi 0 ping -n2 -- "$PEERID_1" && ipfsi 1 ping -n2 -- "$PEERID_0"
|
||||
'
|
||||
|
||||
test_expect_success "test ping self" '
|
||||
! ipfsi 0 ping -n2 -- "$PEERID_0" && ! ipfsi 1 ping -n2 -- "$PEERID_1"
|
||||
'
|
||||
|
||||
test_expect_success "test ping 0" '
|
||||
! ipfsi 0 ping -n0 -- "$PEERID_1" && ! ipfsi 1 ping -n0 -- "$PEERID_0"
|
||||
'
|
||||
|
||||
test_expect_success 'stop iptb' '
|
||||
iptb stop
|
||||
'
|
||||
|
||||
test_done
|
Reference in New Issue
Block a user