提交 4513732e 作者: Jeromy Johnson 提交者: GitHub

Merge pull request #3583 from ipfs/test/dat-serv/raw-links-unused

test: add test for dag service doing short circuit for raw.Links()
......@@ -10,6 +10,7 @@ import (
"strings"
"sync"
"testing"
"time"
blocks "github.com/ipfs/go-ipfs/blocks"
bserv "github.com/ipfs/go-ipfs/blockservice"
......@@ -485,3 +486,21 @@ func TestCidRetention(t *testing.T) {
t.Fatal("output cid didnt match")
}
}
func TestCidRawDoesnNeedData(t *testing.T) {
srv := NewDAGService(dstest.Bserv())
nd := NewRawNode([]byte("somedata"))
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
// there is no data for this node in the blockservice
// so dag service can't load it
links, err := srv.GetLinks(ctx, nd.Cid())
if err != nil {
t.Fatal(err)
}
if len(links) != 0 {
t.Fatal("raw node shouldn't have any links")
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论