Skip to content

Commit

Permalink
fix mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
shrimalmadhur authored and samlaf committed Jun 28, 2024
1 parent 702d2f0 commit ab7dfc4
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 115 deletions.
6 changes: 3 additions & 3 deletions chainio/gen.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package chainio

//go:generate mockgen -destination=./mocks/avsRegistryContractsReader.go -package=mocks github.com/Layr-Labs/eigensdk-go/chainio/clients/avsregistry Reader
//go:generate mockgen -destination=./mocks/avsRegistryContractsSubscriber.go -package=mocks github.com/Layr-Labs/eigensdk-go/chainio/clients/avsregistry Subscriber
//go:generate mockgen -destination=./mocks/avsRegistryContractsWriter.go -package=mocks github.com/Layr-Labs/eigensdk-go/chainio/clients/avsregistry Writer
//go:generate mockgen -destination=./mocks/avsRegistryContractsReader.go -package=mocks -mock_names=Reader=MockAVSReader github.com/Layr-Labs/eigensdk-go/chainio/clients/avsregistry Reader
//go:generate mockgen -destination=./mocks/avsRegistryContractsSubscriber.go -package=mocks -mock_names=Subscriber=MockAVSSubscriber github.com/Layr-Labs/eigensdk-go/chainio/clients/avsregistry Subscriber
//go:generate mockgen -destination=./mocks/avsRegistryContractsWriter.go -package=mocks -mock_names=Writer=MockAVSWriter github.com/Layr-Labs/eigensdk-go/chainio/clients/avsregistry Writer
//go:generate mockgen -destination=./mocks/elContractsReader.go -package=mocks github.com/Layr-Labs/eigensdk-go/chainio/clients/elcontracts ELReader
//go:generate mockgen -destination=./mocks/elContractsWriter.go -package=mocks github.com/Layr-Labs/eigensdk-go/chainio/clients/elcontracts ELWriter
//go:generate mockgen -destination=./mocks/ethclient.go -package=mocks -mock_names=Client=MockEthClient github.com/Layr-Labs/eigensdk-go/chainio/clients/eth Client
Expand Down
102 changes: 51 additions & 51 deletions chainio/mocks/avsRegistryContractsReader.go

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions chainio/mocks/avsRegistryContractsSubscriber.go

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

54 changes: 27 additions & 27 deletions chainio/mocks/avsRegistryContractsWriter.go

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

2 changes: 1 addition & 1 deletion metrics/collectors/economic/economic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestEconomicCollector(t *testing.T) {
elReader := mocks.NewMockELReader(mockCtrl)
elReader.EXPECT().OperatorIsFrozen(gomock.Any(), operatorAddr).Return(false, nil)

avsRegistryReader := mocks.NewMockAvsRegistryReader(mockCtrl)
avsRegistryReader := mocks.NewMockAVSReader(mockCtrl)
avsRegistryReader.EXPECT().GetOperatorId(gomock.Any(), operatorAddr).Return(operatorId, nil)
avsRegistryReader.EXPECT().GetOperatorStakeInQuorumsOfOperatorAtCurrentBlock(gomock.Any(), gomock.Any()).Return(
map[types.QuorumNum]*big.Int{
Expand Down
18 changes: 9 additions & 9 deletions services/avsregistry/avsregistry_chaincaller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ func TestAvsRegistryServiceChainCaller_getOperatorPubkeys(t *testing.T) {
// TODO(samlaf): add error test cases
var tests = []struct {
name string
mocksInitializationFunc func(*chainiomocks.MockAvsRegistryReader, *servicemocks.MockOperatorsInfoService)
mocksInitializationFunc func(*chainiomocks.MockAVSReader, *servicemocks.MockOperatorsInfoService)
queryOperatorId types.OperatorId
wantErr error
wantOperatorInfo types.OperatorInfo
}{
{
name: "should return operator info",
mocksInitializationFunc: func(mockAvsRegistryReader *chainiomocks.MockAvsRegistryReader, mockOperatorsInfoService *servicemocks.MockOperatorsInfoService) {
mocksInitializationFunc: func(mockAvsRegistryReader *chainiomocks.MockAVSReader, mockOperatorsInfoService *servicemocks.MockOperatorsInfoService) {
mockAvsRegistryReader.EXPECT().GetOperatorFromId(gomock.Any(), testOperator.operatorId).Return(testOperator.operatorAddr, nil)
mockOperatorsInfoService.EXPECT().GetOperatorInfo(gomock.Any(), testOperator.operatorAddr).Return(testOperator.operatorInfo, true)
},
Expand All @@ -60,7 +60,7 @@ func TestAvsRegistryServiceChainCaller_getOperatorPubkeys(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
// Create mocks
mockCtrl := gomock.NewController(t)
mockAvsRegistryReader := chainiomocks.NewMockAvsRegistryReader(mockCtrl)
mockAvsRegistryReader := chainiomocks.NewMockAVSReader(mockCtrl)
mockOperatorsInfoService := servicemocks.NewMockOperatorsInfoService(mockCtrl)

if tt.mocksInitializationFunc != nil {
Expand Down Expand Up @@ -97,15 +97,15 @@ func TestAvsRegistryServiceChainCaller_GetOperatorsAvsState(t *testing.T) {

var tests = []struct {
name string
mocksInitializationFunc func(*chainiomocks.MockAvsRegistryReader, *servicemocks.MockOperatorsInfoService)
mocksInitializationFunc func(*chainiomocks.MockAVSReader, *servicemocks.MockOperatorsInfoService)
queryQuorumNumbers types.QuorumNums
queryBlockNum types.BlockNum
wantErr error
wantOperatorsAvsStateDict map[types.OperatorId]types.OperatorAvsState
}{
{
name: "should return operatorsAvsState",
mocksInitializationFunc: func(mockAvsRegistryReader *chainiomocks.MockAvsRegistryReader, mockOperatorsInfoService *servicemocks.MockOperatorsInfoService) {
mocksInitializationFunc: func(mockAvsRegistryReader *chainiomocks.MockAVSReader, mockOperatorsInfoService *servicemocks.MockOperatorsInfoService) {
mockAvsRegistryReader.EXPECT().GetOperatorsStakeInQuorumsAtBlock(gomock.Any(), types.QuorumNums{1}, types.BlockNum(1)).Return([][]opstateretrievar.OperatorStateRetrieverOperator{
{
{
Expand Down Expand Up @@ -135,7 +135,7 @@ func TestAvsRegistryServiceChainCaller_GetOperatorsAvsState(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
// Create mocks
mockCtrl := gomock.NewController(t)
mockAvsRegistryReader := chainiomocks.NewMockAvsRegistryReader(mockCtrl)
mockAvsRegistryReader := chainiomocks.NewMockAVSReader(mockCtrl)
mockOperatorsInfoService := servicemocks.NewMockOperatorsInfoService(mockCtrl)

if tt.mocksInitializationFunc != nil {
Expand Down Expand Up @@ -172,15 +172,15 @@ func TestAvsRegistryServiceChainCaller_GetQuorumsAvsState(t *testing.T) {

var tests = []struct {
name string
mocksInitializationFunc func(*chainiomocks.MockAvsRegistryReader, *servicemocks.MockOperatorsInfoService)
mocksInitializationFunc func(*chainiomocks.MockAVSReader, *servicemocks.MockOperatorsInfoService)
queryQuorumNumbers types.QuorumNums
queryBlockNum types.BlockNum
wantErr error
wantQuorumsAvsStateDict map[types.QuorumNum]types.QuorumAvsState
}{
{
name: "should return operatorsAvsState",
mocksInitializationFunc: func(mockAvsRegistryReader *chainiomocks.MockAvsRegistryReader, mockOperatorsInfoService *servicemocks.MockOperatorsInfoService) {
mocksInitializationFunc: func(mockAvsRegistryReader *chainiomocks.MockAVSReader, mockOperatorsInfoService *servicemocks.MockOperatorsInfoService) {
mockAvsRegistryReader.EXPECT().GetOperatorsStakeInQuorumsAtBlock(gomock.Any(), types.QuorumNums{1}, types.BlockNum(1)).Return([][]opstateretrievar.OperatorStateRetrieverOperator{
{
{
Expand Down Expand Up @@ -210,7 +210,7 @@ func TestAvsRegistryServiceChainCaller_GetQuorumsAvsState(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
// Create mocks
mockCtrl := gomock.NewController(t)
mockAvsRegistryReader := chainiomocks.NewMockAvsRegistryReader(mockCtrl)
mockAvsRegistryReader := chainiomocks.NewMockAVSReader(mockCtrl)
mockOperatorsInfoService := servicemocks.NewMockOperatorsInfoService(mockCtrl)

if tt.mocksInitializationFunc != nil {
Expand Down
Loading

0 comments on commit ab7dfc4

Please sign in to comment.