Skip to content

Commit 7efe443

Browse files
EN-13432: stub and mock cleanup
1 parent 1fad090 commit 7efe443

File tree

9 files changed

+32
-208
lines changed

9 files changed

+32
-208
lines changed

sharding/chainParametersHolder_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/ElrondNetwork/elrond-go-core/core/check"
99
"github.com/ElrondNetwork/elrond-go-core/data/block"
1010
"github.com/ElrondNetwork/elrond-go/config"
11-
"github.com/ElrondNetwork/elrond-go/sharding/mock"
11+
"github.com/ElrondNetwork/elrond-go/testscommon/epochstartmock"
1212
"github.com/stretchr/testify/require"
1313
)
1414

@@ -17,7 +17,7 @@ func TestNewChainParametersHolder(t *testing.T) {
1717

1818
getDummyArgs := func() ArgsChainParametersHolder {
1919
return ArgsChainParametersHolder{
20-
EpochStartEventNotifier: &mock.EpochStartNotifierStub{},
20+
EpochStartEventNotifier: &epochstartmock.EpochStartNotifierStub{},
2121
ChainParameters: []config.ChainParametersByEpochConfig{
2222
{
2323
EnableEpoch: 0,
@@ -167,7 +167,7 @@ func TestChainParametersHolder_ChainParametersForEpoch(t *testing.T) {
167167

168168
paramsHolder, _ := NewChainParametersHolder(ArgsChainParametersHolder{
169169
ChainParameters: params,
170-
EpochStartEventNotifier: &mock.EpochStartNotifierStub{},
170+
EpochStartEventNotifier: &epochstartmock.EpochStartNotifierStub{},
171171
})
172172

173173
res, _ := paramsHolder.ChainParametersForEpoch(0)
@@ -212,7 +212,7 @@ func TestChainParametersHolder_ChainParametersForEpoch(t *testing.T) {
212212

213213
paramsHolder, _ := NewChainParametersHolder(ArgsChainParametersHolder{
214214
ChainParameters: params,
215-
EpochStartEventNotifier: &mock.EpochStartNotifierStub{},
215+
EpochStartEventNotifier: &epochstartmock.EpochStartNotifierStub{},
216216
})
217217

218218
for i := 0; i < 200; i++ {
@@ -253,7 +253,7 @@ func TestChainParametersHolder_CurrentChainParameters(t *testing.T) {
253253

254254
paramsHolder, _ := NewChainParametersHolder(ArgsChainParametersHolder{
255255
ChainParameters: params,
256-
EpochStartEventNotifier: &mock.EpochStartNotifierStub{},
256+
EpochStartEventNotifier: &epochstartmock.EpochStartNotifierStub{},
257257
})
258258

259259
paramsHolder.EpochStartAction(&block.MetaBlock{Epoch: 0})
@@ -291,7 +291,7 @@ func TestChainParametersHolder_AllChainParameters(t *testing.T) {
291291

292292
paramsHolder, _ := NewChainParametersHolder(ArgsChainParametersHolder{
293293
ChainParameters: params,
294-
EpochStartEventNotifier: &mock.EpochStartNotifierStub{},
294+
EpochStartEventNotifier: &epochstartmock.EpochStartNotifierStub{},
295295
})
296296

297297
returnedAllChainsParameters := paramsHolder.AllChainParameters()
@@ -316,7 +316,7 @@ func TestChainParametersHolder_ConcurrentOperations(t *testing.T) {
316316

317317
paramsHolder, _ := NewChainParametersHolder(ArgsChainParametersHolder{
318318
ChainParameters: chainParams,
319-
EpochStartEventNotifier: &mock.EpochStartNotifierStub{},
319+
EpochStartEventNotifier: &epochstartmock.EpochStartNotifierStub{},
320320
})
321321

322322
numOperations := 500

sharding/mock/epochHandlerMock.go

Lines changed: 0 additions & 16 deletions
This file was deleted.

sharding/mock/epochHandlerStub.go

Lines changed: 0 additions & 20 deletions
This file was deleted.

sharding/mock/hasherStub.go

Lines changed: 0 additions & 28 deletions
This file was deleted.

sharding/mock/listIndexUpdaterStub.go

Lines changed: 0 additions & 20 deletions
This file was deleted.

sharding/mock/multipleShardsCoordinatorFake.go

Lines changed: 0 additions & 94 deletions
This file was deleted.

sharding/nodesCoordinator/indexHashedNodesCoordinatorWithRater_test.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/ElrondNetwork/elrond-go/common"
1717
"github.com/ElrondNetwork/elrond-go/sharding/mock"
1818
"github.com/ElrondNetwork/elrond-go/state"
19+
"github.com/ElrondNetwork/elrond-go/testscommon/epochstartmock"
1920
"github.com/ElrondNetwork/elrond-go/testscommon/genericMocks"
2021
"github.com/ElrondNetwork/elrond-go/testscommon/hashingMocks"
2122
"github.com/ElrondNetwork/elrond-go/testscommon/nodeTypeProviderMock"
@@ -77,7 +78,7 @@ func TestIndexHashedGroupSelectorWithRater_OkValShouldWork(t *testing.T) {
7778
nodeShuffler, err := NewHashValidatorsShuffler(shufflerArgs)
7879
require.Nil(t, err)
7980

80-
epochStartSubscriber := &mock.EpochStartNotifierStub{}
81+
epochStartSubscriber := &epochstartmock.EpochStartNotifierStub{}
8182
bootStorer := genericMocks.NewStorerMock()
8283

8384
arguments := ArgNodesCoordinator{
@@ -176,7 +177,7 @@ func BenchmarkIndexHashedGroupSelectorWithRater_ComputeValidatorsGroup63of400(b
176177
}
177178
nodeShuffler, err := NewHashValidatorsShuffler(shufflerArgs)
178179
require.Nil(b, err)
179-
epochStartSubscriber := &mock.EpochStartNotifierStub{}
180+
epochStartSubscriber := &epochstartmock.EpochStartNotifierStub{}
180181
bootStorer := genericMocks.NewStorerMock()
181182

182183
arguments := ArgNodesCoordinator{
@@ -254,7 +255,7 @@ func Test_ComputeValidatorsGroup63of400(t *testing.T) {
254255
nodeShuffler, err := NewHashValidatorsShuffler(shufflerArgs)
255256
require.Nil(t, err)
256257

257-
epochStartSubscriber := &mock.EpochStartNotifierStub{}
258+
epochStartSubscriber := &epochstartmock.EpochStartNotifierStub{}
258259
bootStorer := genericMocks.NewStorerMock()
259260

260261
arguments := ArgNodesCoordinator{
@@ -329,7 +330,7 @@ func TestIndexHashedGroupSelectorWithRater_GetValidatorWithPublicKeyShouldReturn
329330
nodeShuffler, err := NewHashValidatorsShuffler(sufflerArgs)
330331
require.Nil(t, err)
331332

332-
epochStartSubscriber := &mock.EpochStartNotifierStub{}
333+
epochStartSubscriber := &epochstartmock.EpochStartNotifierStub{}
333334
bootStorer := genericMocks.NewStorerMock()
334335

335336
arguments := ArgNodesCoordinator{
@@ -385,7 +386,7 @@ func TestIndexHashedGroupSelectorWithRater_GetValidatorWithPublicKeyShouldReturn
385386
nodeShuffler, err := NewHashValidatorsShuffler(shufflerArgs)
386387
require.Nil(t, err)
387388

388-
epochStartSubscriber := &mock.EpochStartNotifierStub{}
389+
epochStartSubscriber := &epochstartmock.EpochStartNotifierStub{}
389390
bootStorer := genericMocks.NewStorerMock()
390391

391392
arguments := ArgNodesCoordinator{
@@ -451,7 +452,7 @@ func TestIndexHashedGroupSelectorWithRater_GetValidatorWithPublicKeyShouldWork(t
451452
nodeShuffler, err := NewHashValidatorsShuffler(shufflerArgs)
452453
require.Nil(t, err)
453454

454-
epochStartSubscriber := &mock.EpochStartNotifierStub{}
455+
epochStartSubscriber := &epochstartmock.EpochStartNotifierStub{}
455456
bootStorer := genericMocks.NewStorerMock()
456457

457458
eligibleMap[core.MetachainShardId] = listMeta
@@ -537,7 +538,7 @@ func TestIndexHashedGroupSelectorWithRater_GetAllEligibleValidatorsPublicKeys(t
537538
}
538539
nodeShuffler, err := NewHashValidatorsShuffler(shufflerArgs)
539540
require.Nil(t, err)
540-
epochStartSubscriber := &mock.EpochStartNotifierStub{}
541+
epochStartSubscriber := &epochstartmock.EpochStartNotifierStub{}
541542
bootStorer := genericMocks.NewStorerMock()
542543

543544
eligibleMap[core.MetachainShardId] = listMeta
@@ -850,7 +851,7 @@ func BenchmarkIndexHashedWithRaterGroupSelector_ComputeValidatorsGroup21of400(b
850851
nodeShuffler, err := NewHashValidatorsShuffler(shufflerArgs)
851852
require.Nil(b, err)
852853

853-
epochStartSubscriber := &mock.EpochStartNotifierStub{}
854+
epochStartSubscriber := &epochstartmock.EpochStartNotifierStub{}
854855
bootStorer := genericMocks.NewStorerMock()
855856

856857
arguments := ArgNodesCoordinator{

0 commit comments

Comments
 (0)