Commit 90a5c15f authored by Hector Sanjuan's avatar Hector Sanjuan

merkledag_test.go: Handle short reads in makeTestDAG

License: MIT
Signed-off-by: default avatarHector Sanjuan <hector@protocol.ai>
parent 1bcb27fd
......@@ -134,7 +134,10 @@ func makeTestDAG(t *testing.T, read io.Reader, ds ipld.DAGService) ipld.Node {
p := make([]byte, 512)
nodes := []*ProtoNode{}
var err error
_, err = io.ReadFull(read, p)
n, err = io.ReadFull(read, p)
if n != len(p) {
t.Fatal("should have read 512 bytes from the reader")
}
for err == nil {
protoNode := NodeWithData(p)
nodes = append(nodes, protoNode)
......
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