use an actual worker in the integration tests

This commit is contained in:
aarshkshah1992 2021-05-20 10:03:56 +05:30
parent 6879ae9e6a
commit 77b5e8d045
2 changed files with 9 additions and 118 deletions

View File

@ -50,10 +50,16 @@ func TestPieceProviderReadPiece(t *testing.T) {
localTasks := []sealtasks.TaskType{
sealtasks.TTAddPiece, sealtasks.TTPreCommit1, sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTFetch,
}
testWorker := newTestWorker(WorkerConfig{
csts := statestore.New(namespace.Wrap(dstore, datastore.NewKey("/stmgr/calls")))
// passing a nil executor here mirrors an actual worker setup as it
// will initialize the worker to use the rust proofs lib under the hood
worker := newLocalWorker(nil, WorkerConfig{
TaskTypes: localTasks,
}, localStore, mgr)
err = mgr.AddWorker(ctx, testWorker)
}, remoteStore, localStore, index, mgr, csts)
err = mgr.AddWorker(ctx, worker)
require.NoError(t, err)
// Create piece provider

View File

@ -1,115 +0,0 @@
// Code generated by mockery 2.7.5. DO NOT EDIT.
package mocks
import (
context "context"
abi "github.com/filecoin-project/go-state-types/abi"
fsutil "github.com/filecoin-project/lotus/extern/sector-storage/fsutil"
mock "github.com/stretchr/testify/mock"
storage "github.com/filecoin-project/specs-storage/storage"
stores "github.com/filecoin-project/lotus/extern/sector-storage/stores"
storiface "github.com/filecoin-project/lotus/extern/sector-storage/storiface"
)
// Store is an autogenerated mock type for the Store type
type Store struct {
mock.Mock
}
// AcquireSector provides a mock function with given fields: ctx, s, existing, allocate, sealing, op
func (_m *Store) AcquireSector(ctx context.Context, s storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, sealing storiface.PathType, op storiface.AcquireMode) (storiface.SectorPaths, storiface.SectorPaths, error) {
ret := _m.Called(ctx, s, existing, allocate, sealing, op)
var r0 storiface.SectorPaths
if rf, ok := ret.Get(0).(func(context.Context, storage.SectorRef, storiface.SectorFileType, storiface.SectorFileType, storiface.PathType, storiface.AcquireMode) storiface.SectorPaths); ok {
r0 = rf(ctx, s, existing, allocate, sealing, op)
} else {
r0 = ret.Get(0).(storiface.SectorPaths)
}
var r1 storiface.SectorPaths
if rf, ok := ret.Get(1).(func(context.Context, storage.SectorRef, storiface.SectorFileType, storiface.SectorFileType, storiface.PathType, storiface.AcquireMode) storiface.SectorPaths); ok {
r1 = rf(ctx, s, existing, allocate, sealing, op)
} else {
r1 = ret.Get(1).(storiface.SectorPaths)
}
var r2 error
if rf, ok := ret.Get(2).(func(context.Context, storage.SectorRef, storiface.SectorFileType, storiface.SectorFileType, storiface.PathType, storiface.AcquireMode) error); ok {
r2 = rf(ctx, s, existing, allocate, sealing, op)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// FsStat provides a mock function with given fields: ctx, id
func (_m *Store) FsStat(ctx context.Context, id stores.ID) (fsutil.FsStat, error) {
ret := _m.Called(ctx, id)
var r0 fsutil.FsStat
if rf, ok := ret.Get(0).(func(context.Context, stores.ID) fsutil.FsStat); ok {
r0 = rf(ctx, id)
} else {
r0 = ret.Get(0).(fsutil.FsStat)
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, stores.ID) error); ok {
r1 = rf(ctx, id)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MoveStorage provides a mock function with given fields: ctx, s, types
func (_m *Store) MoveStorage(ctx context.Context, s storage.SectorRef, types storiface.SectorFileType) error {
ret := _m.Called(ctx, s, types)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, storage.SectorRef, storiface.SectorFileType) error); ok {
r0 = rf(ctx, s, types)
} else {
r0 = ret.Error(0)
}
return r0
}
// Remove provides a mock function with given fields: ctx, s, types, force
func (_m *Store) Remove(ctx context.Context, s abi.SectorID, types storiface.SectorFileType, force bool) error {
ret := _m.Called(ctx, s, types, force)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, abi.SectorID, storiface.SectorFileType, bool) error); ok {
r0 = rf(ctx, s, types, force)
} else {
r0 = ret.Error(0)
}
return r0
}
// RemoveCopies provides a mock function with given fields: ctx, s, types
func (_m *Store) RemoveCopies(ctx context.Context, s abi.SectorID, types storiface.SectorFileType) error {
ret := _m.Called(ctx, s, types)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, abi.SectorID, storiface.SectorFileType) error); ok {
r0 = rf(ctx, s, types)
} else {
r0 = ret.Error(0)
}
return r0
}