mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-24 03:47:45 +08:00
Add reversible gc test
License: MIT Signed-off-by: rht <rhtbot@gmail.com>
This commit is contained in:
parent
f417cb5ceb
commit
eb45082103
@ -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}"
|
||||
}
|
||||
|
||||
@ -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 &&
|
||||
|
||||
Loading…
Reference in New Issue
Block a user