Skip to content

Commit 831c48d

Browse files
authoredApr 24, 2024··
standardize mock file name (#10043)
1 parent ed3325b commit 831c48d

File tree

10 files changed

+43
-41
lines changed

10 files changed

+43
-41
lines changed
 

‎cl/aggregation/mock/pool.go ‎cl/aggregation/mock_services/aggregation_pool_mock.go

+12-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎cl/aggregation/pool.go

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"github.com/ledgerwatch/erigon/cl/cltypes/solid"
66
)
77

8+
//go:generate mockgen -destination=./mock_services/aggregation_pool_mock.go -package=mock_services . AggregationPool
89
type AggregationPool interface {
910
AddAttestation(att *solid.Attestation) error
1011
//GetAggregatations(slot uint64, committeeIndex uint64) ([]*solid.Attestation, error)

‎cl/beacon/handler/validator_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"testing"
99

1010
libcommon "github.com/ledgerwatch/erigon-lib/common"
11-
mock_aggregation "github.com/ledgerwatch/erigon/cl/aggregation/mock"
11+
mockaggregation "github.com/ledgerwatch/erigon/cl/aggregation/mock_services"
1212
"github.com/ledgerwatch/erigon/cl/beacon/beacon_router_configuration"
1313
"github.com/ledgerwatch/erigon/cl/cltypes/solid"
1414
"github.com/ledgerwatch/erigon/cl/pool"
@@ -20,13 +20,13 @@ import (
2020
type validatorTestSuite struct {
2121
suite.Suite
2222
apiHandler *ApiHandler
23-
mockAggrPool *mock_aggregation.MockAggregationPool
23+
mockAggrPool *mockaggregation.MockAggregationPool
2424
gomockCtrl *gomock.Controller
2525
}
2626

2727
func (t *validatorTestSuite) SetupTest() {
2828
gomockCtrl := gomock.NewController(t.T())
29-
t.mockAggrPool = mock_aggregation.NewMockAggregationPool(gomockCtrl)
29+
t.mockAggrPool = mockaggregation.NewMockAggregationPool(gomockCtrl)
3030
t.apiHandler = NewApiHandler(
3131
nil,
3232
nil,

‎cl/phase1/core/state/interface.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import libcommon "github.com/ledgerwatch/erigon-lib/common"
44

55
// BeaconStateReader is an interface for reading the beacon state.
66
//
7-
//go:generate mockgen -destination=./mock_services/beacon_state_reader.go -package=mock_services . BeaconStateReader
7+
//go:generate mockgen -destination=./mock_services/beacon_state_reader_mock.go -package=mock_services . BeaconStateReader
88
type BeaconStateReader interface {
99
ValidatorPublicKey(index int) (libcommon.Bytes48, error)
1010
GetDomain(domainType [4]byte, epoch uint64) ([]byte, error)

‎cl/phase1/core/state/mock_services/beacon_state_reader.go ‎cl/phase1/core/state/mock_services/beacon_state_reader_mock.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎cl/phase1/forkchoice/forkchoice_mock.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/ledgerwatch/erigon/cl/pool"
1414
"github.com/ledgerwatch/erigon/cl/transition/impl/eth2"
1515
"github.com/ledgerwatch/erigon/cl/validator/sync_contribution_pool"
16+
syncpoolmock "github.com/ledgerwatch/erigon/cl/validator/sync_contribution_pool/mock_services"
1617
"go.uber.org/mock/gomock"
1718
)
1819

@@ -57,7 +58,7 @@ func makeSyncContributionPoolMock(t *testing.T) sync_contribution_pool.SyncContr
5758
beaconBlockRoot common.Hash
5859
}
5960
u := map[syncContributionKey]*cltypes.Contribution{}
60-
pool := sync_contribution_pool.NewMockSyncContributionPool(ctrl)
61+
pool := syncpoolmock.NewMockSyncContributionPool(ctrl)
6162
pool.EXPECT().AddSyncContribution(gomock.Any(), gomock.Any()).DoAndReturn(func(headState *state.CachingBeaconState, contribution *cltypes.Contribution) error {
6263
key := syncContributionKey{
6364
slot: contribution.Slot,

‎cl/phase1/network/services/sync_committee_messages_service_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/ledgerwatch/erigon/cl/cltypes"
1111
"github.com/ledgerwatch/erigon/cl/phase1/core/state"
1212
"github.com/ledgerwatch/erigon/cl/utils/eth_clock"
13-
"github.com/ledgerwatch/erigon/cl/validator/sync_contribution_pool"
13+
syncpoolmock "github.com/ledgerwatch/erigon/cl/validator/sync_contribution_pool/mock_services"
1414
"github.com/stretchr/testify/require"
1515
gomock "go.uber.org/mock/gomock"
1616
)
@@ -19,7 +19,7 @@ func setupSyncCommitteesServiceTest(t *testing.T, ctrl *gomock.Controller) (Sync
1919
cfg := &clparams.MainnetBeaconConfig
2020
syncedDataManager := synced_data.NewSyncedDataManager(true, cfg)
2121
ethClock := eth_clock.NewMockEthereumClock(ctrl)
22-
syncContributionPool := sync_contribution_pool.NewMockSyncContributionPool(ctrl)
22+
syncContributionPool := syncpoolmock.NewMockSyncContributionPool(ctrl)
2323
s := NewSyncCommitteeMessagesService(cfg, ethClock, syncedDataManager, syncContributionPool, true)
2424
syncContributionPool.EXPECT().AddSyncCommitteeMessage(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
2525
return s, syncedDataManager, ethClock

‎cl/phase1/network/services/sync_contribution_service_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/ledgerwatch/erigon/cl/cltypes/solid"
1313
"github.com/ledgerwatch/erigon/cl/phase1/core/state"
1414
"github.com/ledgerwatch/erigon/cl/utils/eth_clock"
15-
"github.com/ledgerwatch/erigon/cl/validator/sync_contribution_pool"
15+
syncpoolmock "github.com/ledgerwatch/erigon/cl/validator/sync_contribution_pool/mock_services"
1616
"github.com/stretchr/testify/require"
1717
gomock "go.uber.org/mock/gomock"
1818
)
@@ -21,7 +21,7 @@ func setupSyncContributionServiceTest(t *testing.T, ctrl *gomock.Controller) (Sy
2121
cfg := &clparams.MainnetBeaconConfig
2222
syncedDataManager := synced_data.NewSyncedDataManager(true, cfg)
2323
ethClock := eth_clock.NewMockEthereumClock(ctrl)
24-
syncContributionPool := sync_contribution_pool.NewMockSyncContributionPool(ctrl)
24+
syncContributionPool := syncpoolmock.NewMockSyncContributionPool(ctrl)
2525
s := NewSyncContributionService(syncedDataManager, cfg, syncContributionPool, ethClock, beaconevents.NewEmitters(), true)
2626
syncContributionPool.EXPECT().AddSyncContribution(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
2727
return s, syncedDataManager, ethClock

‎cl/validator/sync_contribution_pool/interface.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
// SyncContributionPool is an interface for managing sync committee contributions and messages.
1010
// it keeps a store of sync committee contributions, if new messages are received they are aggregated with pre-existing contributions.
1111

12-
//go:generate mockgen -source=interface.go -destination=mock.go -package=sync_contribution_pool
12+
//go:generate mockgen -destination=mock_services/sync_contribution_pool_mock.go -package=sync_contribution_pool . SyncContributionPool
1313
type SyncContributionPool interface {
1414
// AddSyncContribution adds a sync committee contribution to the pool.
1515
AddSyncContribution(headState *state.CachingBeaconState, contribution *cltypes.Contribution) error

‎cl/validator/sync_contribution_pool/mock.go ‎cl/validator/sync_contribution_pool/mock_services/sync_contribution_pool_mock.go

+18-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)