Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
585ef2b9
提交
585ef2b9
authored
2月 02, 2016
作者:
Jeromy Johnson
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2275 from ipfs/refactor-iptb-tests
Refactor iptb tests
上级
f5e7a3b2
79b62977
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
43 行增加
和
86 行删除
+43
-86
iptb-lib.sh
test/sharness/lib/iptb-lib.sh
+39
-0
test-lib.sh
test/sharness/lib/test-lib.sh
+3
-0
t0101-iptb-name.sh
test/sharness/t0101-iptb-name.sh
+0
-34
t0121-bootstrap-iptb.sh
test/sharness/t0121-bootstrap-iptb.sh
+0
-13
t0130-multinode.sh
test/sharness/t0130-multinode.sh
+1
-32
t0240-republisher.sh
test/sharness/t0240-republisher.sh
+0
-7
没有找到文件。
test/sharness/lib/iptb-lib.sh
0 → 100644
浏览文件 @
585ef2b9
# iptb test framework
#
# Copyright (c) 2014, 2016 Jeromy Johnson, Christian Couder
# MIT Licensed; see the LICENSE file in this repository.
export
IPTB_ROOT
=
"
$(
pwd
)
/.iptb"
ipfsi
()
{
dir
=
"
$1
"
shift
IPFS_PATH
=
"
$IPTB_ROOT
/
$dir
"
ipfs
"
$@
"
}
check_has_connection
()
{
node
=
"
$1
"
ipfsi
"
$node
"
swarm peers
>
"swarm_peers_
$node
"
&&
grep
"ipfs"
"swarm_peers_
$node
"
>
/dev/null
}
startup_cluster
()
{
num_nodes
=
"
$1
"
bound
=
$(
expr
$num_nodes
- 1
)
test_expect_success
"start up nodes"
'
iptb start
'
test_expect_success
"connect nodes to eachother"
'
iptb connect [1-$bound] 0
'
for
i
in
$(
test_seq 1
$bound
)
do
test_expect_success
"node
$i
is connected"
'
check_has_connection "$i" ||
test_fsh cat "swarm_peers_$i"
'
done
}
test/sharness/lib/test-lib.sh
浏览文件 @
585ef2b9
...
...
@@ -53,6 +53,9 @@ fi
# source our generic test lib
.
../../ipfs-test-lib.sh
# source iptb lib
.
../lib/iptb-lib.sh
test_cmp_repeat_10_sec
()
{
for
i
in
$(
test_seq 1 100
)
do
...
...
test/sharness/t0101-iptb-name.sh
浏览文件 @
585ef2b9
...
...
@@ -8,46 +8,12 @@ test_description="Test ipfs repo operations"
.
lib/test-lib.sh
export
IPTB_ROOT
=
"
`
pwd
`
/.iptb"
num_nodes
=
4
ipfsi
()
{
dir
=
"
$1
"
shift
IPFS_PATH
=
"
$IPTB_ROOT
/
$dir
"
ipfs
$@
}
test_expect_success
"set up an iptb cluster"
'
iptb init -n $num_nodes -p 0 -f --bootstrap=none
'
check_has_connection
()
{
node
=
$1
ipfsi
$node
swarm peers |
grep
ipfs
>
/dev/null
}
startup_cluster
()
{
bound
=
`
expr
$num_nodes
- 1
`
test_expect_success
"start up nodes"
'
iptb start
'
test_expect_success
"connect nodes to eachother"
'
iptb connect [1-$bound] 0
'
test_expect_success
"nodes are connected"
'
for i in `seq $bound`
do
if ! check_has_connection $i; then
echo "oh shit guys"
return 1
fi
done
'
}
startup_cluster
$num_nodes
test_expect_success
"add an obect on one node"
'
...
...
test/sharness/t0121-bootstrap-iptb.sh
浏览文件 @
585ef2b9
...
...
@@ -17,19 +17,6 @@ test_expect_success "disable mdns" '
test_launch_ipfs_daemon
export
IPTB_ROOT
=
"
`
pwd
`
/.iptb"
ipfsi
()
{
dir
=
"
$1
"
shift
IPFS_PATH
=
"
$IPTB_ROOT
/
$dir
"
ipfs
$@
}
check_has_connection
()
{
node
=
$1
ipfsi
$node
swarm peers |
grep
ipfs
>
/dev/null
}
test_expect_success
"setup iptb nodes"
'
iptb init -n 5 -f --bootstrap=none --port=0
'
...
...
test/sharness/t0130-multinode.sh
浏览文件 @
585ef2b9
...
...
@@ -8,37 +8,6 @@ test_description="Test multiple ipfs nodes"
.
lib/test-lib.sh
export
IPTB_ROOT
=
"
`
pwd
`
/.iptb"
ipfsi
()
{
dir
=
"
$1
"
shift
IPFS_PATH
=
"
$IPTB_ROOT
/
$dir
"
ipfs
$@
}
check_has_connection
()
{
node
=
$1
ipfsi
$node
swarm peers |
grep
ipfs
>
/dev/null
}
startup_cluster
()
{
test_expect_success
"start up nodes"
'
iptb start
'
test_expect_success
"connect nodes to eachother"
'
iptb connect [1-4] 0
'
test_expect_success
"nodes are connected"
'
check_has_connection 0 &&
check_has_connection 1 &&
check_has_connection 2 &&
check_has_connection 3 &&
check_has_connection 4
'
}
check_file_fetch
()
{
node
=
$1
fhash
=
$2
...
...
@@ -54,7 +23,7 @@ check_file_fetch() {
}
run_basic_test
()
{
startup_cluster
startup_cluster
5
test_expect_success
"add a file on node1"
'
random 1000000 > filea &&
...
...
test/sharness/t0240-republisher.sh
浏览文件 @
585ef2b9
...
...
@@ -8,15 +8,8 @@ test_description="Test ipfs repo operations"
.
lib/test-lib.sh
export
IPTB_ROOT
=
"
`
pwd
`
/.iptb"
export
DEBUG
=
true
ipfsi
()
{
dir
=
"
$1
"
shift
IPFS_PATH
=
"
$IPTB_ROOT
/
$dir
"
ipfs
"
$@
"
}
setup_iptb
()
{
test_expect_success
"iptb init"
'
iptb init -n4 --bootstrap none --port 0
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论