mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-03 23:38:07 +08:00
test: add test for dag service doing short circuit for raw.Links()
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
parent
defd1a17e5
commit
4f2bc9f818
@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user