Commit 933b9733 authored by Juan Benet's avatar Juan Benet

Merge pull request #1912 from ipfs/t0220-bitswap-stat

t0220: add 'ipfs bitswap stat' tests
parents d82ff148 3e57460c
......@@ -18,6 +18,37 @@ test_expect_success "'ipfs block get' adds hash to wantlist" '
grep $NONEXIST wantlist_out
'
test_expect_success "'ipfs bitswap stat' succeeds" '
ipfs bitswap stat >stat_out
'
test_expect_success "'ipfs bitswap stat' output looks good" '
cat >expected <<EOF &&
bitswap status
provides buffer: 0 / 256
blocks received: 0
dup blocks received: 0
dup data received: 0B
wantlist [1 keys]
$NONEXIST
partners [0]
EOF
test_cmp expected stat_out
'
test_expect_success "ipfs peer id looks good" '
PEERID=$(ipfs config Identity.PeerID) &&
test_check_peerid "$PEERID"
'
test_expect_success "'ipfs bitswap wantlist -p' works" '
ipfs bitswap wantlist -p "$PEERID" >wantlist_p_out
'
test_expect_failure "'ipfs bitswap wantlist -p' output looks good" '
test_cmp wantlist_out wantlist_p_out
'
test_expect_success "'ipfs bitswap unwant' succeeds" '
ipfs bitswap unwant $NONEXIST
'
......@@ -27,6 +58,31 @@ test_expect_success "hash was removed from wantlist" '
test_must_be_empty wantlist_out
'
test_expect_success "'ipfs bitswap stat' succeeds" '
ipfs bitswap stat >stat_out
'
test_expect_success "'ipfs bitswap stat' output looks good" '
cat >expected <<EOF &&
bitswap status
provides buffer: 0 / 256
blocks received: 0
dup blocks received: 0
dup data received: 0B
wantlist [0 keys]
partners [0]
EOF
test_cmp expected stat_out
'
test_expect_success "'ipfs bitswap wantlist -p' works" '
ipfs bitswap wantlist -p "$PEERID" >wantlist_p_out
'
test_expect_success "'ipfs bitswap wantlist -p' output looks good" '
test_cmp wantlist_out wantlist_p_out
'
test_kill_ipfs_daemon
test_done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment