Fix tests
This commit is contained in:
parent
3d2084ab93
commit
7153e1dd05
@ -285,7 +285,7 @@ func (pf *partialFile) HasAllocated(offset storiface.UnpaddedByteIndex, size abi
|
||||
return false, err
|
||||
}
|
||||
|
||||
u, err := rlepluslazy.Union(have, pieceRun(offset.Padded(), size.Padded()))
|
||||
u, err := rlepluslazy.And(have, pieceRun(offset.Padded(), size.Padded()))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ func (s *seal) unseal(t *testing.T, sb *Sealer, sp *basicfs.Provider, si abi.Sec
|
||||
defer done()
|
||||
|
||||
var b bytes.Buffer
|
||||
err := sb.ReadPiece(context.TODO(), &b, si, 0, 1016)
|
||||
_, err := sb.ReadPiece(context.TODO(), &b, si, 0, 1016)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -130,7 +130,7 @@ func (s *seal) unseal(t *testing.T, sb *Sealer, sp *basicfs.Provider, si abi.Sec
|
||||
}
|
||||
sd()
|
||||
|
||||
err = sb.ReadPiece(context.TODO(), &b, si, 0, 1016)
|
||||
_, err = sb.ReadPiece(context.TODO(), &b, si, 0, 1016)
|
||||
if err == nil {
|
||||
t.Fatal("HOW?!")
|
||||
}
|
||||
@ -141,7 +141,7 @@ func (s *seal) unseal(t *testing.T, sb *Sealer, sp *basicfs.Provider, si abi.Sec
|
||||
}
|
||||
|
||||
b.Reset()
|
||||
err = sb.ReadPiece(context.TODO(), &b, si, 0, 1016)
|
||||
_, err = sb.ReadPiece(context.TODO(), &b, si, 0, 1016)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -150,14 +150,17 @@ func (s *seal) unseal(t *testing.T, sb *Sealer, sp *basicfs.Provider, si abi.Sec
|
||||
require.Equal(t, expect, b.Bytes())
|
||||
|
||||
b.Reset()
|
||||
err = sb.ReadPiece(context.TODO(), &b, si, 0, 2032)
|
||||
have, err := sb.ReadPiece(context.TODO(), &b, si, 0, 2032)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
expect = append(expect, bytes.Repeat([]byte{0}, 1016)...)
|
||||
if !bytes.Equal(b.Bytes(), expect) {
|
||||
t.Fatal("read wrong bytes")
|
||||
if have {
|
||||
t.Errorf("didn't expect to read things")
|
||||
}
|
||||
|
||||
if b.Len() != 0 {
|
||||
t.Fatal("read bytes")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ func (s *schedTestWorker) UnsealPiece(ctx context.Context, id abi.SectorID, inde
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) ReadPiece(ctx context.Context, writer io.Writer, id abi.SectorID, index storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) error {
|
||||
func (s *schedTestWorker) ReadPiece(ctx context.Context, writer io.Writer, id abi.SectorID, index storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ func (t *testWorker) UnsealPiece(ctx context.Context, id abi.SectorID, index sto
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testWorker) ReadPiece(ctx context.Context, writer io.Writer, id abi.SectorID, index storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) error {
|
||||
func (t *testWorker) ReadPiece(ctx context.Context, writer io.Writer, id abi.SectorID, index storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user