Skip to content

Commit

Permalink
test/block: rm mixed hash
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Overbool <overbool.xu@gmail.com>
  • Loading branch information
overbool committed Nov 13, 2018
1 parent 848c8b8 commit 3f4a4a5
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/sharness/t0050-block.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,15 @@ test_expect_success "'ipfs block rm' block actually removed" '
test_must_fail ipfs block stat $HASH
'

RANDOMHASH=QmRKqGMAM6EbngbZjSqrvYzq5Qd8b1bSWymjSUY9zQSNDq
DIRHASH=QmdWmVmM6W2abTgkEfpbtA1CJyTWS2rhuUB9uP1xV8Uwtf
FILE1HASH=Qmae3RedM7SNkWGsdzYzsr6svmsFdsva4WoTvYYsWhUSVz
FILE2HASH=QmUtkGLvPf63NwVzLPKPUYgwhn8ZYPWF6vKWN3fZ2amfJF
FILE3HASH=Qmesmmf1EEG1orJb6XdK6DabxexsseJnCfw8pqWgonbkoj
TESTHASH=QmeomffUNfmQy76CQGy9NdmqEnnHU9soCexBnGU3ezPHVH

test_expect_success "add and pin directory" '
echo "test" | ipfs add --pin=false &&
mkdir adir &&
echo "file1" > adir/file1 &&
echo "file2" > adir/file2 &&
Expand Down Expand Up @@ -113,6 +116,18 @@ test_expect_success "multi-block 'ipfs block rm' output looks good" '
grep -F -q "removed $FILE3HASH" actual_rm
'

test_expect_success "multi-block 'ipfs block rm <invalid> <valid> <invalid>'" '
test_must_fail ipfs block rm $RANDOMHASH $TESTHASH $RANDOMHASH &> actual_mixed_rm
'

test_expect_success "multi-block 'ipfs block rm <invalid> <valid> <invalid>' output looks good" '
echo "cannot remove $RANDOMHASH: blockstore: block not found" >> expect_mixed_rm &&
echo "removed $TESTHASH" >> expect_mixed_rm &&
echo "cannot remove $RANDOMHASH: blockstore: block not found" >> expect_mixed_rm &&
echo "Error: some blocks not removed" >> expect_mixed_rm
test_cmp actual_mixed_rm expect_mixed_rm
'

test_expect_success "'add some blocks' succeeds" '
echo "Hello Mars!" | ipfs block put &&
echo "Hello Venus!" | ipfs block put
Expand All @@ -125,7 +140,6 @@ test_expect_success "add and pin directory" '

HASH=QmRKqGMAM6EZngbpjSqrvYzq5Qd8b1bSWymjSUY9zQSNDk
HASH2=QmdnpnsaEj69isdw5sNzp3h3HkaDz7xKq7BmvFFBzNr5e7
RANDOMHASH=QmRKqGMAM6EbngbZjSqrvYzq5Qd8b1bSWymjSUY9zQSNDq

test_expect_success "multi-block 'ipfs block rm' mixed" '
test_must_fail ipfs block rm $FILE1HASH $DIRHASH $HASH $FILE3HASH $RANDOMHASH $HASH2 2> block_rm_err
Expand Down

0 comments on commit 3f4a4a5

Please sign in to comment.