提交 c93adf67 作者: Steven Allen

test(sharness): fix flaky repo test

Just make sure we've removed all the blocks. We can't guarantee that the size
will revert.
上级 3f30a7ca
......@@ -398,30 +398,6 @@ file_size() {
$_STAT "$1"
}
directory_size() {
local total=0
local fsize=0
local res=0
find "$1" -type f | ( while read fname; do
fsize=$(file_size "$fname")
res=$?
if ! test $res -eq 0; then
if ! test -e "$fname"; then
continue;
fi
echo "failed to get filesize" >&2
return $res
fi
total=$(expr "$total" + "$fsize")
res=$?
if ! test $res -eq 0; then
echo "filesize not a number: $fsize" >&2
return $res
fi
done
echo "$total" ) # do not remove this subshell
}
test_check_peerid() {
peeridlen=$(echo "$1" | tr -dC "[:alnum:]" | wc -c | tr -d " ") &&
test "$peeridlen" = "46" || {
......
......@@ -50,8 +50,7 @@ test_expect_success "'ipfs pin rm' output looks good" '
test_expect_success "ipfs repo gc fully reverse ipfs add (part 1)" '
ipfs repo gc &&
random 100000 41 >gcfile &&
expected="$(directory_size "$IPFS_PATH/blocks")" &&
find "$IPFS_PATH/blocks" -type f &&
find "$IPFS_PATH/blocks" -type f | sort -u > expected_blocks &&
hash=$(ipfs add -q gcfile) &&
ipfs pin rm -r $hash &&
ipfs repo gc
......@@ -60,9 +59,8 @@ test_expect_success "ipfs repo gc fully reverse ipfs add (part 1)" '
test_kill_ipfs_daemon
test_expect_success "ipfs repo gc fully reverse ipfs add (part 2)" '
actual=$(directory_size "$IPFS_PATH/blocks") &&
{ test "$actual" -eq "$expected" || test_fsh echo "$actual != $expected"; } &&
{ test "$actual" -gt "0" || test_fsh echo "not($actual > 0)"; }
find "$IPFS_PATH/blocks" -type f | sort -u > actual_blocks &&
test_cmp expected_blocks actual_blocks
'
test_launch_ipfs_daemon --offline
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论