Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
2b2e570c
提交
2b2e570c
authored
7月 12, 2019
作者:
Steven Allen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sharness: test pin ls stream
上级
20e64aeb
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
28 行增加
和
23 行删除
+28
-23
t0085-pins.sh
test/sharness/t0085-pins.sh
+28
-23
没有找到文件。
test/sharness/t0085-pins.sh
浏览文件 @
2b2e570c
...
...
@@ -10,8 +10,9 @@ test_description="Test ipfs pinning operations"
test_pins
()
{
EXTRA_ARGS
=
$1
BASE
=
$2
PIN_ARGS
=
"
$1
"
LS_ARGS
=
"
$2
"
BASE
=
$3
if
[
-n
"
$BASE
"
]
;
then
BASE_ARGS
=
"--cid-base=
$BASE
"
fi
...
...
@@ -44,11 +45,11 @@ test_pins() {
'
fi
test_expect_success
"'ipfs pin add
$
EXTRA
_ARGS
' via stdin"
'
cat hashes | ipfs pin add $
EXTRA
_ARGS $BASE_ARGS | tee actual
test_expect_success
"'ipfs pin add
$
PIN
_ARGS
' via stdin"
'
cat hashes | ipfs pin add $
PIN
_ARGS $BASE_ARGS | tee actual
'
test_expect_success
"'ipfs pin add
$
EXTRA
_ARGS
' output looks good"
'
test_expect_success
"'ipfs pin add
$
PIN
_ARGS
' output looks good"
'
sed -e "s/^/pinned /; s/$/ recursively/" hashes > expected &&
test_cmp expected actual
'
...
...
@@ -69,8 +70,8 @@ test_pins() {
test_should_contain "$HASH_G ok" verify_out
'
test_expect_success
"ipfs pin ls
$BASE_ARGS
works"
'
ipfs pin ls $BASE_ARGS > ls_out &&
test_expect_success
"ipfs pin ls
$
LS_ARGS
$
BASE_ARGS
works"
'
ipfs pin ls $
LS_ARGS $
BASE_ARGS > ls_out &&
test_should_contain "$HASH_A" ls_out &&
test_should_contain "$HASH_B" ls_out &&
test_should_contain "$HASH_C" ls_out &&
...
...
@@ -80,9 +81,9 @@ test_pins() {
test_should_contain "$HASH_G" ls_out
'
test_expect_success
"test pin ls
$BASE_ARGS
hash"
'
test_expect_success
"test pin ls
$
LS_ARGS
$
BASE_ARGS
hash"
'
echo $HASH_B | test_must_fail grep /ipfs && # just to be sure
ipfs pin ls $BASE_ARGS $HASH_B > ls_hash_out &&
ipfs pin ls $
LS_ARGS $
BASE_ARGS $HASH_B > ls_hash_out &&
echo "$HASH_B recursive" > ls_hash_exp &&
test_cmp ls_hash_exp ls_hash_out
'
...
...
@@ -93,11 +94,11 @@ test_pins() {
test_expect_success
"test pin update"
'
ipfs pin add "$HASH_A" &&
ipfs pin ls $BASE_ARGS | tee before_update &&
ipfs pin ls $
LS_ARGS $
BASE_ARGS | tee before_update &&
test_should_contain "$HASH_A" before_update &&
test_must_fail grep -q "$HASH_B" before_update &&
ipfs pin update --unpin=true "$HASH_A" "$HASH_B" &&
ipfs pin ls $BASE_ARGS > after_update &&
ipfs pin ls $
LS_ARGS $
BASE_ARGS > after_update &&
test_must_fail grep -q "$HASH_A" after_update &&
test_should_contain "$HASH_B" after_update &&
ipfs pin rm "$HASH_B"
...
...
@@ -107,20 +108,20 @@ test_pins() {
RANDOM_HASH
=
Qme8uX5n9hn15pw9p6WcVKoziyyC9LXv4LEgvsmKMULjnV
test_pins_error_reporting
()
{
EXTRA
_ARGS
=
$1
PIN
_ARGS
=
$1
test_expect_success
"'ipfs pin add
$
EXTRA
_ARGS
' on non-existent hash should fail"
'
test_must_fail ipfs pin add $
EXTRA
_ARGS $RANDOM_HASH 2> err &&
test_expect_success
"'ipfs pin add
$
PIN
_ARGS
' on non-existent hash should fail"
'
test_must_fail ipfs pin add $
PIN
_ARGS $RANDOM_HASH 2> err &&
grep -q "not found" err
'
}
test_pin_dag_init
()
{
EXTRA
_ARGS
=
$1
PIN
_ARGS
=
$1
test_expect_success
"'ipfs add
$
EXTRA
_ARGS
--pin=false' 1MB file"
'
test_expect_success
"'ipfs add
$
PIN
_ARGS
--pin=false' 1MB file"
'
random 1048576 56 > afile &&
HASH=`ipfs add $
EXTRA
_ARGS --pin=false -q afile`
HASH=`ipfs add $
PIN
_ARGS --pin=false -q afile`
'
}
...
...
@@ -162,9 +163,11 @@ test_pin_progress() {
test_init_ipfs
test_pins
test_pins
--progress
test_pins
''
base32
test_pins
''
''
''
test_pins
--progress
''
''
test_pins
--progress
--stream
''
test_pins
''
''
base32
test_pins
''
--stream
base32
test_pins_error_reporting
test_pins_error_reporting
--progress
...
...
@@ -176,9 +179,11 @@ test_pin_progress
test_launch_ipfs_daemon
--offline
test_pins
test_pins
--progress
test_pins
''
base32
test_pins
''
''
''
test_pins
--progress
''
''
test_pins
--progress
--stream
''
test_pins
''
''
base32
test_pins
''
--stream
base32
test_pins_error_reporting
test_pins_error_reporting
--progress
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论