From c31f4de7d5560d7e0667fde6abcef5bf4dcbcd5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 9 Dec 2021 16:26:59 +0100 Subject: [PATCH] Fix mock ReadPiece --- extern/sector-storage/mock/mock.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/extern/sector-storage/mock/mock.go b/extern/sector-storage/mock/mock.go index 4d0592d36..8eaed54f6 100644 --- a/extern/sector-storage/mock/mock.go +++ b/extern/sector-storage/mock/mock.go @@ -390,14 +390,16 @@ func (mgr *SectorMgr) ReadPiece(ctx context.Context, sector storage.SectorRef, o panic("implme") } + br := bytes.NewReader(mgr.pieces[mgr.sectors[sector.ID].pieces[0]][:size]) + return struct { io.ReadCloser io.Seeker io.ReaderAt }{ - ReadCloser: ioutil.NopCloser(bytes.NewReader(mgr.pieces[mgr.sectors[sector.ID].pieces[0]][:size])), - Seeker: nil, - ReaderAt: nil, + ReadCloser: ioutil.NopCloser(br), + Seeker: br, + ReaderAt: br, }, false, nil }