vet fixes

This commit is contained in:
Łukasz Magiera 2020-06-09 11:14:25 +02:00
parent 3cd79b6fec
commit 9dfe8851f8
2 changed files with 2 additions and 21 deletions

View File

@ -12,27 +12,6 @@ import (
"github.com/filecoin-project/sector-storage/fr32" "github.com/filecoin-project/sector-storage/fr32"
) )
func TestPadReader(t *testing.T) {
ps := abi.PaddedPieceSize(64 << 20).Unpadded()
raw := bytes.Repeat([]byte{0x55}, int(ps))
r, err := fr32.NewPadReader(bytes.NewReader(raw), ps)
if err != nil {
t.Fatal(err)
}
readerPadded, err := ioutil.ReadAll(r)
if err != nil {
t.Fatal(err)
}
padOut := make([]byte, ps.Padded())
fr32.Pad(raw, padOut)
require.Equal(t, padOut, readerPadded)
}
func TestUnpadReader(t *testing.T) { func TestUnpadReader(t *testing.T) {
ps := abi.PaddedPieceSize(64 << 20).Unpadded() ps := abi.PaddedPieceSize(64 << 20).Unpadded()

View File

@ -26,9 +26,11 @@ func (l *readonlyProvider) AcquireSector(ctx context.Context, id abi.SectorID, e
// use TryLock to avoid blocking // use TryLock to avoid blocking
locked, err := l.index.StorageTryLock(ctx, id, existing, stores.FTNone) locked, err := l.index.StorageTryLock(ctx, id, existing, stores.FTNone)
if err != nil { if err != nil {
cancel()
return stores.SectorPaths{}, nil, xerrors.Errorf("acquiring sector lock: %w", err) return stores.SectorPaths{}, nil, xerrors.Errorf("acquiring sector lock: %w", err)
} }
if !locked { if !locked {
cancel()
return stores.SectorPaths{}, nil, xerrors.Errorf("failed to acquire sector lock") return stores.SectorPaths{}, nil, xerrors.Errorf("failed to acquire sector lock")
} }