Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
39c101cd
提交
39c101cd
authored
3月 04, 2016
作者:
Jeromy Johnson
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2433 from ipfs/fix/t0060-port-zero
make t0060 use port zero
上级
a75a5a3e
7072dab3
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
32 行增加
和
39 行删除
+32
-39
test-lib.sh
test/sharness/lib/test-lib.sh
+19
-13
t0060-daemon.sh
test/sharness/t0060-daemon.sh
+13
-26
没有找到文件。
test/sharness/lib/test-lib.sh
浏览文件 @
39c101cd
...
...
@@ -181,25 +181,15 @@ test_wait_for_file() {
done
}
test_launch_ipfs_daemon
()
{
args
=
"
$@
"
test_expect_success
"'ipfs daemon' succeeds"
'
ipfs daemon $args >actual_daemon 2>daemon_err &
'
# wait for api file to show up
test_expect_success
"api file shows up"
'
test_wait_for_file 20 100ms "$IPFS_PATH/api"
'
test_set_address_vars
()
{
daemon_output
=
"
$1
"
test_expect_success
"set up address variables"
'
API_MADDR=$(cat "$IPFS_PATH/api") &&
API_ADDR=$(convert_tcp_maddr $API_MADDR) &&
API_PORT=$(port_from_maddr $API_MADDR) &&
GWAY_MADDR=$(sed -n "s/^Gateway (.*) server listening on //p"
actual_daemon
) &&
GWAY_MADDR=$(sed -n "s/^Gateway (.*) server listening on //p"
"$daemon_output"
) &&
GWAY_ADDR=$(convert_tcp_maddr $GWAY_MADDR) &&
GWAY_PORT=$(port_from_maddr $GWAY_MADDR)
'
...
...
@@ -210,6 +200,22 @@ test_launch_ipfs_daemon() {
SWARM_MADDR=$(grep "127.0.0.1" addrs_out) &&
SWARM_PORT=$(port_from_maddr $SWARM_MADDR)
'
}
test_launch_ipfs_daemon
()
{
args
=
"
$@
"
test_expect_success
"'ipfs daemon' succeeds"
'
ipfs daemon $args >actual_daemon 2>daemon_err &
'
# wait for api file to show up
test_expect_success
"api file shows up"
'
test_wait_for_file 20 100ms "$IPFS_PATH/api"
'
test_set_address_vars actual_daemon
# we say the daemon is ready when the API server is ready.
test_expect_success
"'ipfs daemon' is ready"
'
...
...
test/sharness/t0060-daemon.sh
浏览文件 @
39c101cd
...
...
@@ -8,27 +8,8 @@ test_description="Test daemon command"
.
lib/test-lib.sh
gwyport
=
8082
apiport
=
5002
swarmport
=
4003
# TODO: randomize ports here once we add --config to ipfs daemon
# this needs to be in a different test than "ipfs daemon" below
test_expect_success
"setup IPFS_PATH"
'
IPFS_PATH="$(pwd)/.ipfs" &&
export IPFS_PATH
'
api_maddr
=
"/ip4/0.0.0.0/tcp/
$apiport
"
gway_maddr
=
"/ip4/0.0.0.0/tcp/
$gwyport
"
test_expect_success
'ipfs init & config'
'
ipfs init &&
ipfs config Addresses.Gateway $gway_maddr &&
ipfs config Addresses.API $api_maddr &&
ipfs config --json=true Addresses.Swarm "[\"/ip4/0.0.0.0/tcp/4003\"]"
'
test_init_ipfs
test_launch_ipfs_daemon
# this errors if we didn't --init $IPFS_PATH correctly
...
...
@@ -47,11 +28,11 @@ test_expect_success "ipfs peer id looks good" '
# this is for checking SetAllowedOrigins race condition for the api and gateway
# See https://github.com/ipfs/go-ipfs/pull/1966
test_expect_success
"ipfs API works with the correct allowed origin port"
'
curl -s -X GET -H "Origin:http://localhost:$
apiport" -I "http://localhost:$apiport
/api/v0/version"
curl -s -X GET -H "Origin:http://localhost:$
API_PORT" -I "http://$API_ADDR
/api/v0/version"
'
test_expect_success
"ipfs gateway works with the correct allowed origin port"
'
curl -s -X GET -H "Origin:http://localhost:$
gwyport" -I "http://localhost:$gwyport
/api/v0/version"
curl -s -X GET -H "Origin:http://localhost:$
GWAY_PORT" -I "http://$GWAY_ADDR
/api/v0/version"
'
test_expect_success
"ipfs daemon output looks good"
'
...
...
@@ -100,14 +81,14 @@ test_expect_success "nc is available" '
# check transport is encrypted
test_expect_success
"transport should be encrypted"
'
nc -w 5 localhost
'
$swarmport
'
>swarmnc &&
nc -w 5 localhost
$SWARM_PORT
>swarmnc &&
grep -q "AES-256,AES-128" swarmnc &&
test_must_fail grep -q "/multistream/1.0.0" swarmnc ||
test_fsh cat swarmnc
'
test_expect_success
"output from streaming commands works"
'
test_expect_code 28 curl -m 2 http://localhost:
'
$apiport
'
/api/v0/stats/bw\?poll=true > statsout
test_expect_code 28 curl -m 2 http://localhost:
$API_PORT
/api/v0/stats/bw\?poll=true > statsout
'
test_expect_success
"output looks good"
'
...
...
@@ -128,9 +109,15 @@ test_expect_success "'ipfs daemon' can be killed" '
'
test_expect_success
"'ipfs daemon' should be able to run with a pipe attached to stdin (issue #861)"
'
yes | ipfs daemon --init >stdin_daemon_out 2>stdin_daemon_err &
yes | ipfs daemon >stdin_daemon_out 2>stdin_daemon_err &
DAEMON_PID=$!
test_wait_for_file 20 100ms "$IPFS_PATH/api" &&
test_set_address_vars stdin_daemon_out
'
test_expect_success
"daemon with pipe eventually becomes live"
'
pollEndpoint -host='
$API_MADDR
' -ep=/version -v -tout=1s -tries=10 >stdin_poll_apiout 2>stdin_poll_apierr &&
test_kill_repeat_10_sec $
!
||
test_kill_repeat_10_sec $
DAEMON_PID
||
test_fsh cat stdin_daemon_out || test_fsh cat stdin_daemon_err || test_fsh cat stdin_poll_apiout || test_fsh cat stdin_poll_apierr
'
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论