提交 0f376b57 作者: Steven Allen

test duplicate CIDs in getMany

License: MIT
Signed-off-by: 's avatarSteven Allen <steven@stebalien.com>
上级 97ac9c4e
......@@ -550,6 +550,36 @@ func TestCidRawDoesnNeedData(t *testing.T) {
}
}
func TestGetManyDuplicate(t *testing.T) {
ctx := context.Background()
srv := NewDAGService(dstest.Bserv())
nd := NodeWithData([]byte("foo"))
if err := srv.Add(ctx, nd); err != nil {
t.Fatal(err)
}
nds := srv.GetMany(ctx, []*cid.Cid{nd.Cid(), nd.Cid(), nd.Cid()})
out, ok := <-nds
if !ok {
t.Fatal("expecting node foo")
}
if out.Err != nil {
t.Fatal(out.Err)
}
if !out.Node.Cid().Equals(nd.Cid()) {
t.Fatal("got wrong node")
}
out, ok = <-nds
if ok {
if out.Err != nil {
t.Fatal(out.Err)
} else {
t.Fatal("expecting no more nodes")
}
}
}
func TestEnumerateAsyncFailsNotFound(t *testing.T) {
ctx := context.Background()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论