vet fixes
This commit is contained in:
parent
3cd79b6fec
commit
9dfe8851f8
@ -12,27 +12,6 @@ import (
|
||||
"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) {
|
||||
ps := abi.PaddedPieceSize(64 << 20).Unpadded()
|
||||
|
||||
|
@ -26,9 +26,11 @@ func (l *readonlyProvider) AcquireSector(ctx context.Context, id abi.SectorID, e
|
||||
// use TryLock to avoid blocking
|
||||
locked, err := l.index.StorageTryLock(ctx, id, existing, stores.FTNone)
|
||||
if err != nil {
|
||||
cancel()
|
||||
return stores.SectorPaths{}, nil, xerrors.Errorf("acquiring sector lock: %w", err)
|
||||
}
|
||||
if !locked {
|
||||
cancel()
|
||||
return stores.SectorPaths{}, nil, xerrors.Errorf("failed to acquire sector lock")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user