Commit ed9d23b6 authored by Michael Avila's avatar Michael Avila Committed by hannahhoward

Fix tests to pass

Due to new architecture of EnumLinks, remove order concerns and prevent
crashes on calls to fetch CID
parent edbb7a34
......@@ -11,6 +11,7 @@ import (
dag "github.com/ipfs/go-merkledag"
mdtest "github.com/ipfs/go-merkledag/test"
ft "github.com/ipfs/go-unixfs"
ipld "github.com/ipfs/go-ipld-format"
......@@ -100,6 +101,8 @@ func assertSerializationWorks(ds ipld.DAGService, s *Shard) error {
return fmt.Errorf("links arrays are different sizes")
}
sort.Stable(dag.LinkSlice(linksA))
sort.Stable(dag.LinkSlice(linksB))
for i, a := range linksA {
b := linksB[i]
if a.Name != b.Name {
......@@ -280,14 +283,17 @@ func TestSetAfterMarshal(t *testing.T) {
t.Fatal(err)
}
empty := ft.EmptyDirNode()
for i := 0; i < 100; i++ {
empty := ft.EmptyDirNode()
err := nds.Set(ctx, fmt.Sprintf("moredirs%d", i), empty)
if err != nil {
t.Fatal(err)
}
}
nd, err = nds.Node()
nds, err = NewHamtFromDag(ds, nd)
links, err := nds.EnumLinks(ctx)
if err != nil {
t.Fatal(err)
......@@ -319,6 +325,9 @@ func TestDuplicateAddShard(t *testing.T) {
t.Fatal(err)
}
node, err := dir.Node()
dir, err = NewHamtFromDag(ds, node)
lnks, err := dir.EnumLinks(ctx)
if err != nil {
t.Fatal(err)
......@@ -411,6 +420,9 @@ func TestRemoveElemsAfterMarshal(t *testing.T) {
}
}
nd, err = nds.Node()
nds, err = NewHamtFromDag(ds, nd)
links, err := nds.EnumLinks(ctx)
if err != nil {
t.Fatal(err)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment