mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-30 01:52:26 +08:00
merkledag_test.go: Handle short reads in makeTestDAG
License: MIT Signed-off-by: Hector Sanjuan <hector@protocol.ai>
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user