From 31a5f68dfae7063ad2f540141db2c85e20637fee Mon Sep 17 00:00:00 2001 From: aarshkshah1992 Date: Thu, 20 May 2021 10:03:56 +0530 Subject: [PATCH] use an actual worker in the integration tests --- extern/sector-storage/piece_provider_test.go | 12 +- extern/sector-storage/stores/mocks/Store.go | 115 ------------------- 2 files changed, 9 insertions(+), 118 deletions(-) delete mode 100644 extern/sector-storage/stores/mocks/Store.go diff --git a/extern/sector-storage/piece_provider_test.go b/extern/sector-storage/piece_provider_test.go index 08aadb78e..b6234d70a 100644 --- a/extern/sector-storage/piece_provider_test.go +++ b/extern/sector-storage/piece_provider_test.go @@ -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 diff --git a/extern/sector-storage/stores/mocks/Store.go b/extern/sector-storage/stores/mocks/Store.go deleted file mode 100644 index 2be0a3075..000000000 --- a/extern/sector-storage/stores/mocks/Store.go +++ /dev/null @@ -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 -}