Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
24f0d020
提交
24f0d020
authored
2月 01, 2015
作者:
Juan Batiz-Benet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sharness: better config setting
上级
56b6a206
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
47 行增加
和
11 行删除
+47
-11
test-lib.sh
test/sharness/lib/test-lib.sh
+45
-9
t0110-gateway.sh
test/sharness/t0110-gateway.sh
+1
-1
t0111-gateway-writable.sh
test/sharness/t0111-gateway-writable.sh
+1
-1
没有找到文件。
test/sharness/lib/test-lib.sh
浏览文件 @
24f0d020
...
...
@@ -100,6 +100,30 @@ test_wait_open_tcp_port_10_sec() {
return
1
}
# test_config_set helps us make sure _we really did set_ a config value.
# it sets it and then tests it. This became elaborate because ipfs config
# was setting really weird things and am not sure why.
test_config_set
()
{
# grab flags (like -bool in "ipfs config -bool")
test_cfg_flags
=
""
# unset in case.
test
"$#"
=
3
&&
{
test_cfg_flags
=
$1
;
shift
;
}
test_cfg_key
=
$1
test_cfg_val
=
$2
# when verbose, tell the user what config values are being set
test_cfg_cmd
=
"ipfs config
$test_cfg_flags
\"
$test_cfg_key
\"
\"
$test_cfg_val
\"
"
test
"
$TEST_VERBOSE
"
=
1
&&
echo
"
$test_cfg_cmd
"
# ok try setting the config key/val pair.
ipfs config
$test_cfg_flags
"
$test_cfg_key
"
"
$test_cfg_val
"
echo
"
$test_cfg_val
"
>
cfg_set_expected
ipfs config
"
$test_cfg_key
"
>
cfg_set_actual
test_cmp cfg_set_expected cfg_set_actual
}
test_init_ipfs
()
{
test_expect_success
"ipfs init succeeds"
'
...
...
@@ -107,33 +131,45 @@ test_init_ipfs() {
ipfs init -b=1024 > /dev/null
'
test_expect_success
"prepare config"
'
test_expect_success
"prepare config
-- mounting and bootstrap rm
"
'
mkdir mountdir ipfs ipns &&
ipfs config Mounts.IPFS "$(pwd)/ipfs" &&
ipfs config Mounts.IPNS "$(pwd)/ipns" &&
ipfs bootstrap rm --all
test_config_set Mounts.IPFS "$(pwd)/ipfs" &&
test_config_set Mounts.IPNS "$(pwd)/ipns" &&
ipfs bootstrap rm --all ||
fsh cat "\"$IPFS_PATH/config\""
'
}
test_config_ipfs_gateway_readonly
()
{
test_expect_success
"prepare config -- gateway readonly"
'
ipfs config "Addresses.Gateway" "/ip4/0.0.0.0/tcp/5002"
if
test
"
$1
"
==
""
;
then
echo
"must call with an address, for example:"
echo
'test_config_ipfs_gateway_readonly "/ip4/0.0.0.0/tcp/5002"'
return
1
# todo: find a better way to exit here.
fi
GWAY_ADDR
=
$1
test_expect_success
"prepare config -- gateway address"
'
test_config_set "Addresses.Gateway" "$GWAY_ADDR"
'
}
test_config_ipfs_gateway_writable
()
{
test_config_ipfs_gateway_readonly
$1
test_expect_success
"prepare config -- gateway writable"
'
ipfs config "Addresses.Gateway" "/ip4/0.0.0.0/tcp/5002" &&
ipfs config -bool "Gateway.Writable" true
test_config_set -bool Gateway.Writable true ||
fsh cat "\"$IPFS_PATH/config\""
'
}
test_launch_ipfs_daemon
()
{
ADDR_API
=
"/ip4/127.0.0.1/tcp/5001"
ADDR_GWAY
=
`
ipfs config Addresses.Gateway
`
NLINES
=
"2"
# ADDR_GWAY will be set if the test_config_ipfs_gateway_* funcs were called.
if
test
"
$ADDR_GWAY
"
!=
""
;
then
NLINES
=
"3"
fi
...
...
test/sharness/t0110-gateway.sh
浏览文件 @
24f0d020
...
...
@@ -9,7 +9,7 @@ test_description="Test HTTP Gateway"
.
lib/test-lib.sh
test_init_ipfs
test_config_ipfs_gateway_readonly
test_config_ipfs_gateway_readonly
"/ip4/0.0.0.0/tcp/5002"
test_launch_ipfs_daemon
# TODO check both 5001 and 5002.
...
...
test/sharness/t0111-gateway-writable.sh
浏览文件 @
24f0d020
...
...
@@ -9,7 +9,7 @@ test_description="Test HTTP Gateway (Writable)"
.
lib/test-lib.sh
test_init_ipfs
test_config_ipfs_gateway_writable
test_config_ipfs_gateway_writable
"/ip4/0.0.0.0/tcp/5002"
test_launch_ipfs_daemon
test_expect_success
"ipfs daemon listening to TCP port 5002"
'
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论