mirror of
https://github.com/ipfs/kubo.git
synced 2025-09-10 14:34:24 +08:00
pinner now requires all nodes exist in blockstore
This commit is contained in:
@ -34,6 +34,10 @@ func TestPinnerBasic(t *testing.T) {
|
||||
p := NewPinner(dstore, dserv)
|
||||
|
||||
a, ak := randNode()
|
||||
_, err = dserv.Add(a)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// Pin A{}
|
||||
err = p.Pin(a, false)
|
||||
@ -45,18 +49,30 @@ func TestPinnerBasic(t *testing.T) {
|
||||
t.Fatal("Failed to find key")
|
||||
}
|
||||
|
||||
// create new node c, to be indirectly pinned through b
|
||||
c, ck := randNode()
|
||||
_, err = dserv.Add(c)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// Create new node b, to be parent to a and c
|
||||
b, _ := randNode()
|
||||
err = b.AddNodeLink("child", a)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
c, ck := randNode()
|
||||
err = b.AddNodeLink("otherchild", c)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
_, err = dserv.Add(b)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// recursively pin B{A,C}
|
||||
err = p.Pin(b, true)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user