Skip to content

Commit

Permalink
Merge pull request #1523 from rht/reversible-gc
Browse files Browse the repository at this point in the history
Add reversible gc test
  • Loading branch information
jbenet committed Jul 28, 2015
2 parents f417cb5 + eb45082 commit 29f67b4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/sharness/lib/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
10 changes: 10 additions & 0 deletions test/sharness/t0080-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down

0 comments on commit 29f67b4

Please sign in to comment.