From 82e725761fce687df5df27737e8aa5101deee3c7 Mon Sep 17 00:00:00 2001 From: Fred Carle Date: Tue, 25 Jun 2024 15:55:57 -0400 Subject: [PATCH] update mocks --- client/mocks/db.go | 68 ++++++++++++++++++++++++++------------ datastore/mocks/txn.go | 74 +++++++++++++++++++++--------------------- 2 files changed, 85 insertions(+), 57 deletions(-) diff --git a/client/mocks/db.go b/client/mocks/db.go index c67de7f20f..089e41c159 100644 --- a/client/mocks/db.go +++ b/client/mocks/db.go @@ -39,6 +39,10 @@ func (_m *DB) EXPECT() *DB_Expecter { func (_m *DB) AddP2PCollections(ctx context.Context, collectionIDs []string) error { ret := _m.Called(ctx, collectionIDs) + if len(ret) == 0 { + panic("no return value specified for AddP2PCollections") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, []string) error); ok { r0 = rf(ctx, collectionIDs) @@ -350,19 +354,19 @@ func (_c *DB_BasicImport_Call) RunAndReturn(run func(context.Context, string) er } // Blockstore provides a mock function with given fields: -func (_m *DB) Blockstore() datastore.DAGStore { +func (_m *DB) Blockstore() datastore.Blockstore { ret := _m.Called() if len(ret) == 0 { panic("no return value specified for Blockstore") } - var r0 datastore.DAGStore - if rf, ok := ret.Get(0).(func() datastore.DAGStore); ok { + var r0 datastore.Blockstore + if rf, ok := ret.Get(0).(func() datastore.Blockstore); ok { r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(datastore.DAGStore) + r0 = ret.Get(0).(datastore.Blockstore) } } @@ -386,12 +390,12 @@ func (_c *DB_Blockstore_Call) Run(run func()) *DB_Blockstore_Call { return _c } -func (_c *DB_Blockstore_Call) Return(_a0 datastore.DAGStore) *DB_Blockstore_Call { +func (_c *DB_Blockstore_Call) Return(_a0 datastore.Blockstore) *DB_Blockstore_Call { _c.Call.Return(_a0) return _c } -func (_c *DB_Blockstore_Call) RunAndReturn(run func() datastore.DAGStore) *DB_Blockstore_Call { +func (_c *DB_Blockstore_Call) RunAndReturn(run func() datastore.Blockstore) *DB_Blockstore_Call { _c.Call.Return(run) return _c } @@ -432,6 +436,10 @@ func (_c *DB_Close_Call) RunAndReturn(run func()) *DB_Close_Call { func (_m *DB) DeleteReplicator(ctx context.Context, rep client.Replicator) error { ret := _m.Called(ctx, rep) + if len(ret) == 0 { + panic("no return value specified for DeleteReplicator") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, client.Replicator) error); ok { r0 = rf(ctx, rep) @@ -629,6 +637,10 @@ func (_c *DB_GetAllIndexes_Call) RunAndReturn(run func(context.Context) (map[str func (_m *DB) GetAllP2PCollections(ctx context.Context) ([]string, error) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetAllP2PCollections") + } + var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context) ([]string, error)); ok { @@ -683,6 +695,10 @@ func (_c *DB_GetAllP2PCollections_Call) RunAndReturn(run func(context.Context) ( func (_m *DB) GetAllReplicators(ctx context.Context) ([]client.Replicator, error) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetAllReplicators") + } + var r0 []client.Replicator var r1 error if rf, ok := ret.Get(0).(func(context.Context) ([]client.Replicator, error)); ok { @@ -1324,6 +1340,10 @@ func (_c *DB_PatchSchema_Call) RunAndReturn(run func(context.Context, string, im func (_m *DB) PeerInfo() peer.AddrInfo { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for PeerInfo") + } + var r0 peer.AddrInfo if rf, ok := ret.Get(0).(func() peer.AddrInfo); ok { r0 = rf() @@ -1458,6 +1478,10 @@ func (_c *DB_PrintDump_Call) RunAndReturn(run func(context.Context) error) *DB_P func (_m *DB) RemoveP2PCollections(ctx context.Context, collectionIDs []string) error { ret := _m.Called(ctx, collectionIDs) + if len(ret) == 0 { + panic("no return value specified for RemoveP2PCollections") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, []string) error); ok { r0 = rf(ctx, collectionIDs) @@ -1497,49 +1521,49 @@ func (_c *DB_RemoveP2PCollections_Call) RunAndReturn(run func(context.Context, [ return _c } -// Root provides a mock function with given fields: -func (_m *DB) Root() datastore.RootStore { +// Rootstore provides a mock function with given fields: +func (_m *DB) Rootstore() datastore.Rootstore { ret := _m.Called() if len(ret) == 0 { - panic("no return value specified for Root") + panic("no return value specified for Rootstore") } - var r0 datastore.RootStore - if rf, ok := ret.Get(0).(func() datastore.RootStore); ok { + var r0 datastore.Rootstore + if rf, ok := ret.Get(0).(func() datastore.Rootstore); ok { r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(datastore.RootStore) + r0 = ret.Get(0).(datastore.Rootstore) } } return r0 } -// DB_Root_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Root' -type DB_Root_Call struct { +// DB_Rootstore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Rootstore' +type DB_Rootstore_Call struct { *mock.Call } -// Root is a helper method to define mock.On call -func (_e *DB_Expecter) Root() *DB_Root_Call { - return &DB_Root_Call{Call: _e.mock.On("Root")} +// Rootstore is a helper method to define mock.On call +func (_e *DB_Expecter) Rootstore() *DB_Rootstore_Call { + return &DB_Rootstore_Call{Call: _e.mock.On("Rootstore")} } -func (_c *DB_Root_Call) Run(run func()) *DB_Root_Call { +func (_c *DB_Rootstore_Call) Run(run func()) *DB_Rootstore_Call { _c.Call.Run(func(args mock.Arguments) { run() }) return _c } -func (_c *DB_Root_Call) Return(_a0 datastore.RootStore) *DB_Root_Call { +func (_c *DB_Rootstore_Call) Return(_a0 datastore.Rootstore) *DB_Rootstore_Call { _c.Call.Return(_a0) return _c } -func (_c *DB_Root_Call) RunAndReturn(run func() datastore.RootStore) *DB_Root_Call { +func (_c *DB_Rootstore_Call) RunAndReturn(run func() datastore.Rootstore) *DB_Rootstore_Call { _c.Call.Return(run) return _c } @@ -1642,6 +1666,10 @@ func (_c *DB_SetMigration_Call) RunAndReturn(run func(context.Context, client.Le func (_m *DB) SetReplicator(ctx context.Context, rep client.Replicator) error { ret := _m.Called(ctx, rep) + if len(ret) == 0 { + panic("no return value specified for SetReplicator") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, client.Replicator) error); ok { r0 = rf(ctx, rep) diff --git a/datastore/mocks/txn.go b/datastore/mocks/txn.go index 7c9872dfb2..f29c045dcd 100644 --- a/datastore/mocks/txn.go +++ b/datastore/mocks/txn.go @@ -22,95 +22,95 @@ func (_m *Txn) EXPECT() *Txn_Expecter { return &Txn_Expecter{mock: &_m.Mock} } -// Commit provides a mock function with given fields: ctx -func (_m *Txn) Commit(ctx context.Context) error { - ret := _m.Called(ctx) +// Blockstore provides a mock function with given fields: +func (_m *Txn) Blockstore() datastore.Blockstore { + ret := _m.Called() if len(ret) == 0 { - panic("no return value specified for Commit") + panic("no return value specified for Blockstore") } - var r0 error - if rf, ok := ret.Get(0).(func(context.Context) error); ok { - r0 = rf(ctx) + var r0 datastore.Blockstore + if rf, ok := ret.Get(0).(func() datastore.Blockstore); ok { + r0 = rf() } else { - r0 = ret.Error(0) + if ret.Get(0) != nil { + r0 = ret.Get(0).(datastore.Blockstore) + } } return r0 } -// Txn_Commit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Commit' -type Txn_Commit_Call struct { +// Txn_Blockstore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Blockstore' +type Txn_Blockstore_Call struct { *mock.Call } -// Commit is a helper method to define mock.On call -// - ctx context.Context -func (_e *Txn_Expecter) Commit(ctx interface{}) *Txn_Commit_Call { - return &Txn_Commit_Call{Call: _e.mock.On("Commit", ctx)} +// Blockstore is a helper method to define mock.On call +func (_e *Txn_Expecter) Blockstore() *Txn_Blockstore_Call { + return &Txn_Blockstore_Call{Call: _e.mock.On("Blockstore")} } -func (_c *Txn_Commit_Call) Run(run func(ctx context.Context)) *Txn_Commit_Call { +func (_c *Txn_Blockstore_Call) Run(run func()) *Txn_Blockstore_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context)) + run() }) return _c } -func (_c *Txn_Commit_Call) Return(_a0 error) *Txn_Commit_Call { +func (_c *Txn_Blockstore_Call) Return(_a0 datastore.Blockstore) *Txn_Blockstore_Call { _c.Call.Return(_a0) return _c } -func (_c *Txn_Commit_Call) RunAndReturn(run func(context.Context) error) *Txn_Commit_Call { +func (_c *Txn_Blockstore_Call) RunAndReturn(run func() datastore.Blockstore) *Txn_Blockstore_Call { _c.Call.Return(run) return _c } -// DAGstore provides a mock function with given fields: -func (_m *Txn) DAGstore() datastore.DAGStore { - ret := _m.Called() +// Commit provides a mock function with given fields: ctx +func (_m *Txn) Commit(ctx context.Context) error { + ret := _m.Called(ctx) if len(ret) == 0 { - panic("no return value specified for DAGstore") + panic("no return value specified for Commit") } - var r0 datastore.DAGStore - if rf, ok := ret.Get(0).(func() datastore.DAGStore); ok { - r0 = rf() + var r0 error + if rf, ok := ret.Get(0).(func(context.Context) error); ok { + r0 = rf(ctx) } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(datastore.DAGStore) - } + r0 = ret.Error(0) } return r0 } -// Txn_DAGstore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DAGstore' -type Txn_DAGstore_Call struct { +// Txn_Commit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Commit' +type Txn_Commit_Call struct { *mock.Call } -// DAGstore is a helper method to define mock.On call -func (_e *Txn_Expecter) DAGstore() *Txn_DAGstore_Call { - return &Txn_DAGstore_Call{Call: _e.mock.On("DAGstore")} +// Commit is a helper method to define mock.On call +// - ctx context.Context +func (_e *Txn_Expecter) Commit(ctx interface{}) *Txn_Commit_Call { + return &Txn_Commit_Call{Call: _e.mock.On("Commit", ctx)} } -func (_c *Txn_DAGstore_Call) Run(run func()) *Txn_DAGstore_Call { +func (_c *Txn_Commit_Call) Run(run func(ctx context.Context)) *Txn_Commit_Call { _c.Call.Run(func(args mock.Arguments) { - run() + run(args[0].(context.Context)) }) return _c } -func (_c *Txn_DAGstore_Call) Return(_a0 datastore.DAGStore) *Txn_DAGstore_Call { +func (_c *Txn_Commit_Call) Return(_a0 error) *Txn_Commit_Call { _c.Call.Return(_a0) return _c } -func (_c *Txn_DAGstore_Call) RunAndReturn(run func() datastore.DAGStore) *Txn_DAGstore_Call { +func (_c *Txn_Commit_Call) RunAndReturn(run func(context.Context) error) *Txn_Commit_Call { _c.Call.Return(run) return _c }