Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
04482cbe
提交
04482cbe
authored
9月 07, 2015
作者:
Matt Bell
提交者:
rht
10月 13, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Consolidated 'resolve' tests
License: MIT Signed-off-by:
Matt Bell
<
mappum@gmail.com
>
上级
dd8267b9
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
45 行增加
和
67 行删除
+45
-67
t0101-resolve.sh
test/sharness/t0101-resolve.sh
+0
-55
t0160-resolve.sh
test/sharness/t0160-resolve.sh
+45
-12
没有找到文件。
test/sharness/t0101-resolve.sh
deleted
100755 → 0
浏览文件 @
dd8267b9
#!/bin/sh
#
# Copyright (c) 2015 Matt Bell
# MIT Licensed; see the LICENSE file in this repository.
#
test_description
=
"Test ipfs resolve operations"
.
lib/test-lib.sh
test_init_ipfs
# setup
test_expect_success
"setup: add files"
'
mkdir mountdir/foodir &&
echo "Hello Mars!" >mountdir/foodir/mars.txt &&
echo "/ipfs/`ipfs add -q mountdir/foodir/mars.txt`" >filehash &&
ipfs add -q -r mountdir/foodir | tail -n 1 >dirhash
'
test_expect_success
"setup: get IPFS ID"
'
ID=`ipfs id --format="<id>\n"`
'
# resolve an IPNS name to a simple /ipfs/ path
test_expect_success
"setup: publish file to IPNS name"
'
ipfs name publish `cat filehash`
'
test_expect_success
"'ipfs resolve' succeeds with IPNS->path"
'
echo `ipfs resolve "/ipns/$ID"` >actual
'
test_expect_success
"'ipfs resolve' output looks good"
'
test_cmp filehash actual
'
# resolve an IPNS name to a /ipfs/HASH/link/name path
test_expect_success
"setup: publish link path to IPNS name"
'
ipfs name publish "`cat dirhash`/mars.txt"
'
test_expect_success
"'ipfs resolve' succeeds with IPNS->link path"
'
echo `ipfs resolve "/ipns/$ID"` >actual
'
test_expect_success
"'ipfs resolve' output looks good"
'
test_cmp filehash actual
'
test_done
test/sharness/t0160-resolve.sh
浏览文件 @
04482cbe
...
...
@@ -14,20 +14,36 @@ test_expect_success "resolve: prepare files" '
c_hash=$(ipfs add -q -r a/b/c | tail -n1)
'
test_expect_success
"resolve: prepare name"
'
id_hash=$(ipfs id -f="<id>") &&
ipfs name publish "$a_hash" &&
printf "/ipfs/$a_hash" >expected_nameval &&
ipfs name resolve >actual_nameval &&
test_cmp expected_nameval actual_nameval
'
test_resolve_setup_name
()
{
ref
=
$1
test_expect_success
"resolve: prepare name"
'
id_hash=$(ipfs id -f="<id>") &&
ipfs name publish "$ref" &&
printf "$ref" >expected_nameval &&
ipfs name resolve >actual_nameval &&
test_cmp expected_nameval actual_nameval
'
}
test_resolve_setup_name_fail
()
{
ref
=
$1
test_expect_failure
"resolve: prepare name"
'
id_hash=$(ipfs id -f="<id>") &&
ipfs name publish "$ref" &&
printf "$ref" >expected_nameval &&
ipfs name resolve >actual_nameval &&
test_cmp expected_nameval actual_nameval
'
}
test_resolve
()
{
src
=
$1
dst
=
$2
test_expect_success
"resolve succeeds:
$src
"
'
ipfs resolve "$src" >actual
ipfs resolve
-r
"$src" >actual
'
test_expect_success
"resolved correctly:
$src
->
$dst
"
'
...
...
@@ -41,10 +57,19 @@ test_resolve_cmd() {
test_resolve
"/ipfs/
$a_hash
"
"/ipfs/
$a_hash
"
test_resolve
"/ipfs/
$a_hash
/b"
"/ipfs/
$b_hash
"
test_resolve
"/ipfs/
$a_hash
/b/c"
"/ipfs/
$c_hash
"
test_resolve
"/ipfs/
$b_hash
/c"
"/ipfs/
$c_hash
"
test_resolve_setup_name
"/ipfs/
$a_hash
"
test_resolve
"/ipns/
$id_hash
"
"/ipfs/
$a_hash
"
test_resolve
"/ipns/
$id_hash
/b"
"/ipfs/
$b_hash
"
test_resolve
"/ipns/
$id_hash
/b/c"
"/ipfs/
$c_hash
"
test_resolve_setup_name
"/ipfs/
$b_hash
"
test_resolve
"/ipns/
$id_hash
"
"/ipfs/
$b_hash
"
test_resolve
"/ipns/
$id_hash
/c"
"/ipfs/
$c_hash
"
test_resolve_setup_name
"/ipfs/
$c_hash
"
test_resolve
"/ipns/
$id_hash
"
"/ipfs/
$c_hash
"
}
#todo remove this once the online resolve is fixed
...
...
@@ -63,14 +88,22 @@ test_resolve_fail() {
}
test_resolve_cmd_fail
()
{
test_resolve
"/ipfs/
$a_hash
"
"/ipfs/
$a_hash
"
test_resolve
"/ipfs/
$a_hash
/b"
"/ipfs/
$b_hash
"
test_resolve
"/ipfs/
$a_hash
/b/c"
"/ipfs/
$c_hash
"
test_resolve
"/ipfs/
$b_hash
/c"
"/ipfs/
$c_hash
"
test_resolve_fail
"/ipfs/
$a_hash
"
"/ipfs/
$a_hash
"
test_resolve_fail
"/ipfs/
$a_hash
/b"
"/ipfs/
$b_hash
"
test_resolve_fail
"/ipfs/
$a_hash
/b/c"
"/ipfs/
$c_hash
"
test_resolve_setup_name_fail
"/ipfs/
$a_hash
"
test_resolve_fail
"/ipns/
$id_hash
"
"/ipfs/
$a_hash
"
test_resolve_fail
"/ipns/
$id_hash
/b"
"/ipfs/
$b_hash
"
test_resolve_fail
"/ipns/
$id_hash
/b/c"
"/ipfs/
$c_hash
"
test_resolve_setup_name_fail
"/ipfs/
$b_hash
"
test_resolve_fail
"/ipns/
$id_hash
"
"/ipfs/
$b_hash
"
test_resolve_fail
"/ipns/
$id_hash
/c"
"/ipfs/
$c_hash
"
test_resolve_setup_name_fail
"/ipfs/
$c_hash
"
test_resolve_fail
"/ipns/
$id_hash
"
"/ipfs/
$c_hash
"
}
# should work offline
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论