github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/network/p2p/mock/rate_limiter.go (about) 1 // Code generated by mockery v2.21.4. DO NOT EDIT. 2 3 package mockp2p 4 5 import ( 6 irrecoverable "github.com/onflow/flow-go/module/irrecoverable" 7 mock "github.com/stretchr/testify/mock" 8 9 peer "github.com/libp2p/go-libp2p/core/peer" 10 ) 11 12 // RateLimiter is an autogenerated mock type for the RateLimiter type 13 type RateLimiter struct { 14 mock.Mock 15 } 16 17 // Allow provides a mock function with given fields: peerID, msgSize 18 func (_m *RateLimiter) Allow(peerID peer.ID, msgSize int) bool { 19 ret := _m.Called(peerID, msgSize) 20 21 var r0 bool 22 if rf, ok := ret.Get(0).(func(peer.ID, int) bool); ok { 23 r0 = rf(peerID, msgSize) 24 } else { 25 r0 = ret.Get(0).(bool) 26 } 27 28 return r0 29 } 30 31 // Done provides a mock function with given fields: 32 func (_m *RateLimiter) Done() <-chan struct{} { 33 ret := _m.Called() 34 35 var r0 <-chan struct{} 36 if rf, ok := ret.Get(0).(func() <-chan struct{}); ok { 37 r0 = rf() 38 } else { 39 if ret.Get(0) != nil { 40 r0 = ret.Get(0).(<-chan struct{}) 41 } 42 } 43 44 return r0 45 } 46 47 // IsRateLimited provides a mock function with given fields: peerID 48 func (_m *RateLimiter) IsRateLimited(peerID peer.ID) bool { 49 ret := _m.Called(peerID) 50 51 var r0 bool 52 if rf, ok := ret.Get(0).(func(peer.ID) bool); ok { 53 r0 = rf(peerID) 54 } else { 55 r0 = ret.Get(0).(bool) 56 } 57 58 return r0 59 } 60 61 // Ready provides a mock function with given fields: 62 func (_m *RateLimiter) Ready() <-chan struct{} { 63 ret := _m.Called() 64 65 var r0 <-chan struct{} 66 if rf, ok := ret.Get(0).(func() <-chan struct{}); ok { 67 r0 = rf() 68 } else { 69 if ret.Get(0) != nil { 70 r0 = ret.Get(0).(<-chan struct{}) 71 } 72 } 73 74 return r0 75 } 76 77 // Start provides a mock function with given fields: _a0 78 func (_m *RateLimiter) Start(_a0 irrecoverable.SignalerContext) { 79 _m.Called(_a0) 80 } 81 82 type mockConstructorTestingTNewRateLimiter interface { 83 mock.TestingT 84 Cleanup(func()) 85 } 86 87 // NewRateLimiter creates a new instance of RateLimiter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. 88 func NewRateLimiter(t mockConstructorTestingTNewRateLimiter) *RateLimiter { 89 mock := &RateLimiter{} 90 mock.Mock.Test(t) 91 92 t.Cleanup(func() { mock.AssertExpectations(t) }) 93 94 return mock 95 }