Add reversible gc test

License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
This commit is contained in:
rht 2015-07-28 09:42:15 +07:00
parent f417cb5ceb
commit eb45082103
2 changed files with 26 additions and 0 deletions

View File

@ -314,3 +314,19 @@ test_str_contains() {
shift
echo "$@" | grep "$find" >/dev/null
}
disk_usage() {
# normalize du across systems
case $(uname -s) in
Linux)
DU="du -sb"
;;
FreeBSD)
DU="du -s -A -B 1"
;;
Darwin | DragonFly)
DU="du"
;;
esac
$DU "$1" | awk "{print \$1}"
}

View File

@ -44,6 +44,16 @@ test_expect_success "'ipfs pin rm' output looks good" '
test_cmp expected1 actual1
'
test_expect_failure "ipfs repo gc fully reverse ipfs add" '
random 100000 41 >gcfile &&
disk_usage "$IPFS_PATH/blocks" >expected &&
hash=`ipfs add -q gcfile` &&
ipfs pin rm -r $hash &&
ipfs repo gc &&
disk_usage "$IPFS_PATH/blocks" >actual &&
test_cmp expected actual
'
test_expect_success "file no longer pinned" '
# we expect the welcome files and gw assets to show up here
echo "$HASH_WELCOME_DOCS" >expected2 &&