Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

standardize mock file name #10043

Merged
merged 3 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cl/aggregation/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/ledgerwatch/erigon/cl/cltypes/solid"
)

//go:generate mockgen -destination=./mock_services/aggregation_pool_mock.go -package=mock_services . AggregationPool
type AggregationPool interface {
AddAttestation(att *solid.Attestation) error
//GetAggregatations(slot uint64, committeeIndex uint64) ([]*solid.Attestation, error)
Expand Down
6 changes: 3 additions & 3 deletions cl/beacon/handler/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"

libcommon "github.com/ledgerwatch/erigon-lib/common"
mock_aggregation "github.com/ledgerwatch/erigon/cl/aggregation/mock"
mockaggregation "github.com/ledgerwatch/erigon/cl/aggregation/mock_services"
"github.com/ledgerwatch/erigon/cl/beacon/beacon_router_configuration"
"github.com/ledgerwatch/erigon/cl/cltypes/solid"
"github.com/ledgerwatch/erigon/cl/pool"
Expand All @@ -20,13 +20,13 @@ import (
type validatorTestSuite struct {
suite.Suite
apiHandler *ApiHandler
mockAggrPool *mock_aggregation.MockAggregationPool
mockAggrPool *mockaggregation.MockAggregationPool
gomockCtrl *gomock.Controller
}

func (t *validatorTestSuite) SetupTest() {
gomockCtrl := gomock.NewController(t.T())
t.mockAggrPool = mock_aggregation.NewMockAggregationPool(gomockCtrl)
t.mockAggrPool = mockaggregation.NewMockAggregationPool(gomockCtrl)
t.apiHandler = NewApiHandler(
nil,
nil,
Expand Down
2 changes: 1 addition & 1 deletion cl/phase1/core/state/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import libcommon "github.com/ledgerwatch/erigon-lib/common"

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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion cl/phase1/forkchoice/forkchoice_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/ledgerwatch/erigon/cl/pool"
"github.com/ledgerwatch/erigon/cl/transition/impl/eth2"
"github.com/ledgerwatch/erigon/cl/validator/sync_contribution_pool"
syncpoolmock "github.com/ledgerwatch/erigon/cl/validator/sync_contribution_pool/mock_services"
"go.uber.org/mock/gomock"
)

Expand Down Expand Up @@ -57,7 +58,7 @@ func makeSyncContributionPoolMock(t *testing.T) sync_contribution_pool.SyncContr
beaconBlockRoot common.Hash
}
u := map[syncContributionKey]*cltypes.Contribution{}
pool := sync_contribution_pool.NewMockSyncContributionPool(ctrl)
pool := syncpoolmock.NewMockSyncContributionPool(ctrl)
pool.EXPECT().AddSyncContribution(gomock.Any(), gomock.Any()).DoAndReturn(func(headState *state.CachingBeaconState, contribution *cltypes.Contribution) error {
key := syncContributionKey{
slot: contribution.Slot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/ledgerwatch/erigon/cl/cltypes"
"github.com/ledgerwatch/erigon/cl/phase1/core/state"
"github.com/ledgerwatch/erigon/cl/utils/eth_clock"
"github.com/ledgerwatch/erigon/cl/validator/sync_contribution_pool"
syncpoolmock "github.com/ledgerwatch/erigon/cl/validator/sync_contribution_pool/mock_services"
"github.com/stretchr/testify/require"
gomock "go.uber.org/mock/gomock"
)
Expand All @@ -19,7 +19,7 @@ func setupSyncCommitteesServiceTest(t *testing.T, ctrl *gomock.Controller) (Sync
cfg := &clparams.MainnetBeaconConfig
syncedDataManager := synced_data.NewSyncedDataManager(true, cfg)
ethClock := eth_clock.NewMockEthereumClock(ctrl)
syncContributionPool := sync_contribution_pool.NewMockSyncContributionPool(ctrl)
syncContributionPool := syncpoolmock.NewMockSyncContributionPool(ctrl)
s := NewSyncCommitteeMessagesService(cfg, ethClock, syncedDataManager, syncContributionPool, true)
syncContributionPool.EXPECT().AddSyncCommitteeMessage(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
return s, syncedDataManager, ethClock
Expand Down
4 changes: 2 additions & 2 deletions cl/phase1/network/services/sync_contribution_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/ledgerwatch/erigon/cl/cltypes/solid"
"github.com/ledgerwatch/erigon/cl/phase1/core/state"
"github.com/ledgerwatch/erigon/cl/utils/eth_clock"
"github.com/ledgerwatch/erigon/cl/validator/sync_contribution_pool"
syncpoolmock "github.com/ledgerwatch/erigon/cl/validator/sync_contribution_pool/mock_services"
"github.com/stretchr/testify/require"
gomock "go.uber.org/mock/gomock"
)
Expand All @@ -21,7 +21,7 @@ func setupSyncContributionServiceTest(t *testing.T, ctrl *gomock.Controller) (Sy
cfg := &clparams.MainnetBeaconConfig
syncedDataManager := synced_data.NewSyncedDataManager(true, cfg)
ethClock := eth_clock.NewMockEthereumClock(ctrl)
syncContributionPool := sync_contribution_pool.NewMockSyncContributionPool(ctrl)
syncContributionPool := syncpoolmock.NewMockSyncContributionPool(ctrl)
s := NewSyncContributionService(syncedDataManager, cfg, syncContributionPool, ethClock, beaconevents.NewEmitters(), true)
syncContributionPool.EXPECT().AddSyncContribution(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
return s, syncedDataManager, ethClock
Expand Down
2 changes: 1 addition & 1 deletion cl/validator/sync_contribution_pool/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
// SyncContributionPool is an interface for managing sync committee contributions and messages.
// it keeps a store of sync committee contributions, if new messages are received they are aggregated with pre-existing contributions.

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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading