prysm-pulse/shared/mock/event_service_mock.go
Raul Jordan 4551bb47fc
Add Events Streaming Endpoint for Eth2 Standard API (#9001)
* begin event source support

* add in events server and proto definitions

* fmt

* add in stream support and proper building

* add in the protos

* tidy

* add structure and comments

* fmt

* revert proto changes

* only return events we explicitly request

* capture missing events needed for eth2 apis

* handle underflow

* no hash tree roots

* gazelle

* static

* race tests passing

* simplify

* handle all required events

* begin on stream tests

* correctness and abstracting method for forwarding to state feed

* genesis root

* include missing pieces

* logging

* rem and and handle return

* added mock

* add in mock

* add tests for block events

* added comprehensive tests

* radek comments

* add missing unit tests

* updatemockgen file

* viz

* done

* Update beacon-chain/rpc/eventsv1/events.go

* Update beacon-chain/rpc/eventsv1/events.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2021-06-14 16:58:08 +00:00

302 lines
11 KiB
Go
Generated

// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/prysmaticlabs/prysm/proto/eth/v1 (interfaces: EventsClient,Events_StreamEventsClient,Events_StreamEventsServer)
// Package mock is a generated GoMock package.
package mock
import (
context "context"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
gateway "github.com/grpc-ecosystem/grpc-gateway/v2/proto/gateway"
v1 "github.com/prysmaticlabs/prysm/proto/eth/v1"
grpc "google.golang.org/grpc"
metadata "google.golang.org/grpc/metadata"
)
// MockEventsClient is a mock of EventsClient interface.
type MockEventsClient struct {
ctrl *gomock.Controller
recorder *MockEventsClientMockRecorder
}
// MockEventsClientMockRecorder is the mock recorder for MockEventsClient.
type MockEventsClientMockRecorder struct {
mock *MockEventsClient
}
// NewMockEventsClient creates a new mock instance.
func NewMockEventsClient(ctrl *gomock.Controller) *MockEventsClient {
mock := &MockEventsClient{ctrl: ctrl}
mock.recorder = &MockEventsClientMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockEventsClient) EXPECT() *MockEventsClientMockRecorder {
return m.recorder
}
// StreamEvents mocks base method.
func (m *MockEventsClient) StreamEvents(arg0 context.Context, arg1 *v1.StreamEventsRequest, arg2 ...grpc.CallOption) (v1.Events_StreamEventsClient, error) {
m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "StreamEvents", varargs...)
ret0, _ := ret[0].(v1.Events_StreamEventsClient)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// StreamEvents indicates an expected call of StreamEvents.
func (mr *MockEventsClientMockRecorder) StreamEvents(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StreamEvents", reflect.TypeOf((*MockEventsClient)(nil).StreamEvents), varargs...)
}
// MockEvents_StreamEventsClient is a mock of Events_StreamEventsClient interface.
type MockEvents_StreamEventsClient struct {
ctrl *gomock.Controller
recorder *MockEvents_StreamEventsClientMockRecorder
}
// MockEvents_StreamEventsClientMockRecorder is the mock recorder for MockEvents_StreamEventsClient.
type MockEvents_StreamEventsClientMockRecorder struct {
mock *MockEvents_StreamEventsClient
}
// NewMockEvents_StreamEventsClient creates a new mock instance.
func NewMockEvents_StreamEventsClient(ctrl *gomock.Controller) *MockEvents_StreamEventsClient {
mock := &MockEvents_StreamEventsClient{ctrl: ctrl}
mock.recorder = &MockEvents_StreamEventsClientMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockEvents_StreamEventsClient) EXPECT() *MockEvents_StreamEventsClientMockRecorder {
return m.recorder
}
// CloseSend mocks base method.
func (m *MockEvents_StreamEventsClient) CloseSend() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CloseSend")
ret0, _ := ret[0].(error)
return ret0
}
// CloseSend indicates an expected call of CloseSend.
func (mr *MockEvents_StreamEventsClientMockRecorder) CloseSend() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockEvents_StreamEventsClient)(nil).CloseSend))
}
// Context mocks base method.
func (m *MockEvents_StreamEventsClient) Context() context.Context {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Context")
ret0, _ := ret[0].(context.Context)
return ret0
}
// Context indicates an expected call of Context.
func (mr *MockEvents_StreamEventsClientMockRecorder) Context() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockEvents_StreamEventsClient)(nil).Context))
}
// Header mocks base method.
func (m *MockEvents_StreamEventsClient) Header() (metadata.MD, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Header")
ret0, _ := ret[0].(metadata.MD)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Header indicates an expected call of Header.
func (mr *MockEvents_StreamEventsClientMockRecorder) Header() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockEvents_StreamEventsClient)(nil).Header))
}
// Recv mocks base method.
func (m *MockEvents_StreamEventsClient) Recv() (*gateway.EventSource, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Recv")
ret0, _ := ret[0].(*gateway.EventSource)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Recv indicates an expected call of Recv.
func (mr *MockEvents_StreamEventsClientMockRecorder) Recv() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockEvents_StreamEventsClient)(nil).Recv))
}
// RecvMsg mocks base method.
func (m *MockEvents_StreamEventsClient) RecvMsg(arg0 interface{}) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RecvMsg", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// RecvMsg indicates an expected call of RecvMsg.
func (mr *MockEvents_StreamEventsClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockEvents_StreamEventsClient)(nil).RecvMsg), arg0)
}
// SendMsg mocks base method.
func (m *MockEvents_StreamEventsClient) SendMsg(arg0 interface{}) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SendMsg", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// SendMsg indicates an expected call of SendMsg.
func (mr *MockEvents_StreamEventsClientMockRecorder) SendMsg(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockEvents_StreamEventsClient)(nil).SendMsg), arg0)
}
// Trailer mocks base method.
func (m *MockEvents_StreamEventsClient) Trailer() metadata.MD {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Trailer")
ret0, _ := ret[0].(metadata.MD)
return ret0
}
// Trailer indicates an expected call of Trailer.
func (mr *MockEvents_StreamEventsClientMockRecorder) Trailer() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockEvents_StreamEventsClient)(nil).Trailer))
}
// MockEvents_StreamEventsServer is a mock of Events_StreamEventsServer interface.
type MockEvents_StreamEventsServer struct {
ctrl *gomock.Controller
recorder *MockEvents_StreamEventsServerMockRecorder
}
// MockEvents_StreamEventsServerMockRecorder is the mock recorder for MockEvents_StreamEventsServer.
type MockEvents_StreamEventsServerMockRecorder struct {
mock *MockEvents_StreamEventsServer
}
// NewMockEvents_StreamEventsServer creates a new mock instance.
func NewMockEvents_StreamEventsServer(ctrl *gomock.Controller) *MockEvents_StreamEventsServer {
mock := &MockEvents_StreamEventsServer{ctrl: ctrl}
mock.recorder = &MockEvents_StreamEventsServerMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockEvents_StreamEventsServer) EXPECT() *MockEvents_StreamEventsServerMockRecorder {
return m.recorder
}
// Context mocks base method.
func (m *MockEvents_StreamEventsServer) Context() context.Context {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Context")
ret0, _ := ret[0].(context.Context)
return ret0
}
// Context indicates an expected call of Context.
func (mr *MockEvents_StreamEventsServerMockRecorder) Context() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockEvents_StreamEventsServer)(nil).Context))
}
// RecvMsg mocks base method.
func (m *MockEvents_StreamEventsServer) RecvMsg(arg0 interface{}) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RecvMsg", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// RecvMsg indicates an expected call of RecvMsg.
func (mr *MockEvents_StreamEventsServerMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockEvents_StreamEventsServer)(nil).RecvMsg), arg0)
}
// Send mocks base method.
func (m *MockEvents_StreamEventsServer) Send(arg0 *gateway.EventSource) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Send", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// Send indicates an expected call of Send.
func (mr *MockEvents_StreamEventsServerMockRecorder) Send(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockEvents_StreamEventsServer)(nil).Send), arg0)
}
// SendHeader mocks base method.
func (m *MockEvents_StreamEventsServer) SendHeader(arg0 metadata.MD) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SendHeader", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// SendHeader indicates an expected call of SendHeader.
func (mr *MockEvents_StreamEventsServerMockRecorder) SendHeader(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendHeader", reflect.TypeOf((*MockEvents_StreamEventsServer)(nil).SendHeader), arg0)
}
// SendMsg mocks base method.
func (m *MockEvents_StreamEventsServer) SendMsg(arg0 interface{}) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SendMsg", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// SendMsg indicates an expected call of SendMsg.
func (mr *MockEvents_StreamEventsServerMockRecorder) SendMsg(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockEvents_StreamEventsServer)(nil).SendMsg), arg0)
}
// SetHeader mocks base method.
func (m *MockEvents_StreamEventsServer) SetHeader(arg0 metadata.MD) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SetHeader", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// SetHeader indicates an expected call of SetHeader.
func (mr *MockEvents_StreamEventsServerMockRecorder) SetHeader(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*MockEvents_StreamEventsServer)(nil).SetHeader), arg0)
}
// SetTrailer mocks base method.
func (m *MockEvents_StreamEventsServer) SetTrailer(arg0 metadata.MD) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "SetTrailer", arg0)
}
// SetTrailer indicates an expected call of SetTrailer.
func (mr *MockEvents_StreamEventsServerMockRecorder) SetTrailer(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockEvents_StreamEventsServer)(nil).SetTrailer), arg0)
}