Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
54a98918
提交
54a98918
authored
11月 15, 2015
作者:
rht
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add gc auto test
License: MIT Signed-off-by:
rht
<
rhtbot@gmail.com
>
上级
76dedd84
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
70 行增加
和
0 行删除
+70
-0
t0082-repo-gc-auto.sh
test/sharness/t0082-repo-gc-auto.sh
+70
-0
没有找到文件。
test/sharness/t0082-repo-gc-auto.sh
0 → 100755
浏览文件 @
54a98918
#!/bin/sh
#
# MIT Licensed; see the LICENSE file in this repository.
#
test_description
=
"Test ipfs repo auto gc"
.
lib/test-lib.sh
check_ipfs_storage
()
{
ipfs config Datastore.StorageMax
}
test_init_ipfs
test_expect_success
"generate 2 600 kB files and 2 MB file using go-random"
'
random 600k 41 >600k1 &&
random 600k 42 >600k2 &&
random 2M 43 >2M
'
test_expect_success
"set ipfs gc watermark, storage max, and gc timeout"
'
test_config_set Datastore.StorageMax "2MB" &&
test_config_set --json Datastore.StorageGCWatermark 60 &&
test_config_set Datastore.GCPeriod "20ms"
'
test_launch_ipfs_daemon
--enable-gc
test_gc
()
{
test_expect_success
"adding data below watermark doesn't trigger auto gc"
'
ipfs add 600k1 >/dev/null &&
disk_usage "$IPFS_PATH/blocks" >expected &&
go-sleep 40ms &&
disk_usage "$IPFS_PATH/blocks" >actual &&
test_cmp expected actual
'
test_expect_success
"adding data beyond watermark triggers auto gc"
'
HASH=`ipfs add -q 600k2` &&
ipfs pin rm -r $HASH &&
go-sleep 40ms &&
DU=$(disk_usage "$IPFS_PATH/blocks") &&
if test $(uname -s) = "Darwin"; then
test "$DU" -lt 1400 # 60% of 2MB
else
test "$DU" -lt 1000000
fi
'
}
#TODO: conditional GC test is disabled due to files size bug in ipfs add
#test_expect_success "adding data beyond storageMax fails" '
# test_must_fail ipfs add 2M 2>add_fail_out
#'
#test_expect_success "ipfs add not enough space message looks good" '
# echo "Error: file size exceeds slack space allowed by storageMax. Maybe unpin some files?" >add_fail_exp &&
# test_cmp add_fail_exp add_fail_out
#'
test_expect_success
"periodic auto gc stress test"
'
for i in $(test_seq 1 20)
do
test_gc
done
'
test_kill_ipfs_daemon
test_done
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论