Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
62f1614f
提交
62f1614f
authored
11月 06, 2014
作者:
Juan Batiz-Benet
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #248 from chriscool/test_ipfs_mount
Add test for ipfs mount
上级
a9d90852
22ac5997
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
146 行增加
和
0 行删除
+146
-0
.gitignore
test/.gitignore
+1
-0
t0030-mount.sh
test/t0030-mount.sh
+15
-0
t0040-add-and-cat.sh
test/t0040-add-and-cat.sh
+84
-0
test-lib.sh
test/test-lib.sh
+46
-0
没有找到文件。
test/.gitignore
浏览文件 @
62f1614f
test-results/
test-results/
trash directory.*.sh/
test/t0030-mount.sh
0 → 100755
浏览文件 @
62f1614f
#!/bin/sh
#
# Copyright (c) 2014 Christian Couder
# MIT Licensed; see the LICENSE file in this repository.
#
test_description
=
"Test mount command"
.
./test-lib.sh
test_launch_ipfs_mount
test_kill_ipfs_mount
test_done
test/t0040-add-and-cat.sh
0 → 100755
浏览文件 @
62f1614f
#!/bin/sh
#
# Copyright (c) 2014 Christian Couder
# MIT Licensed; see the LICENSE file in this repository.
#
test_description
=
"Test add and cat commands"
.
./test-lib.sh
test_launch_ipfs_mount
test_expect_success
"ipfs add succeeds"
'
echo "Hello Worlds!" >mountdir/hello.txt &&
ipfs add mountdir/hello.txt >actual
'
test_expect_success
"ipfs add output looks good"
'
HASH="QmVr26fY1tKyspEJBniVhqxQeEjhF78XerGiqWAwraVLQH" &&
echo "added $HASH $(pwd)/mountdir/hello.txt" >expected &&
test_cmp expected actual
'
test_expect_success
"ipfs cat succeeds"
'
ipfs cat $HASH >actual
'
test_expect_success
"ipfs cat output looks good"
'
echo "Hello Worlds!" >expected &&
test_cmp expected actual
'
test_expect_success
"cat ipfs/stuff succeeds"
'
cat ipfs/$HASH >actual
'
test_expect_success
"cat ipfs/stuff looks good"
'
test_cmp expected actual
'
test_expect_success
"go-random is installed"
'
type random
'
test_expect_success
"generate 100MB file using go-random"
'
random 104857600 42 >mountdir/bigfile
'
test_expect_success
"sha1 of the file looks ok"
'
echo "54dc0dbbc353b2ffb745285793f89af0c9d98449 mountdir/bigfile" >sha1_expected &&
sha1sum mountdir/bigfile >sha1_actual &&
test_cmp sha1_expected sha1_actual
'
test_expect_success
"ipfs add bigfile succeeds"
'
ipfs add mountdir/bigfile >actual
'
test_expect_success
"ipfs add bigfile output looks good"
'
HASH="QmeZVkWkDu4W1vxWdDgUbqKYba9K3u45hJEdPA4Wr2sHZz" &&
echo "added $HASH $(pwd)/mountdir/bigfile" >expected &&
test_cmp expected actual
'
test_expect_success
"ipfs cat succeeds"
'
ipfs cat $HASH | sha1sum >sha1_actual
'
test_expect_success
"ipfs cat output looks good"
'
echo "54dc0dbbc353b2ffb745285793f89af0c9d98449 -" >sha1_expected &&
test_cmp sha1_expected sha1_actual
'
test_expect_success
"cat ipfs/bigfile succeeds"
'
cat ipfs/$HASH | sha1sum >sha1_actual
'
test_expect_success
"cat ipfs/bigfile looks good"
'
test_cmp sha1_expected sha1_actual
'
test_kill_ipfs_mount
test_done
test/test-lib.sh
浏览文件 @
62f1614f
...
@@ -16,3 +16,49 @@
...
@@ -16,3 +16,49 @@
# Please put go-ipfs specific shell functions below
# Please put go-ipfs specific shell functions below
test_cmp_repeat_10_sec
()
{
for
i
in
1 2 3 4 5 6 7 8 9 10
do
test_cmp
"
$1
"
"
$2
"
&&
return
sleep 1
done
test_cmp
"
$1
"
"
$2
"
}
test_launch_ipfs_mount
()
{
test_expect_success
"ipfs init succeeds"
'
export IPFS_DIR="$(pwd)/.go-ipfs" &&
ipfs init -b=2048
'
test_expect_success
"prepare config"
'
mkdir mountdir ipfs ipns &&
ipfs config Mounts.IPFS "$(pwd)/ipfs" &&
ipfs config Mounts.IPNS "$(pwd)/ipns"
'
test_expect_success
"ipfs mount succeeds"
'
ipfs mount mountdir >actual &
'
test_expect_success
"ipfs mount output looks good"
'
IPFS_PID=$! &&
echo "mounting ipfs at $(pwd)/ipfs" >expected &&
echo "mounting ipns at $(pwd)/ipns" >>expected &&
test_cmp_repeat_10_sec expected actual
'
}
test_kill_ipfs_mount
()
{
test_expect_success
"ipfs mount is still running"
'
kill -0 $IPFS_PID
'
test_expect_success
"ipfs mount can be killed"
'
kill $IPFS_PID &&
sleep 1 &&
! kill -0 $IPFS_PID 2>/dev/null
'
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论