Skip to content

Commit

Permalink
Merge pull request #1912 from ipfs/t0220-bitswap-stat
Browse files Browse the repository at this point in the history
t0220: add 'ipfs bitswap stat' tests
jbenet committed Oct 30, 2015
2 parents d82ff14 + 3e57460 commit 933b973
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions test/sharness/t0220-bitswap.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 933b973

Please sign in to comment.