8c33d7cc0e
* Rate limiting handler - ensure configuration has changed before modifying limiters * Updating test to validate arguments to UpdateConfig * Removing duplicate test. Updating mock. * adding logging for when UpdateConfig is called but the config has not changed. * Update agent/consul/rate/handler.go Co-authored-by: Dhia Ayachi <dhia@hashicorp.com> Co-authored-by: Dhia Ayachi <dhia@hashicorp.com>
54 lines
1.3 KiB
Go
54 lines
1.3 KiB
Go
// Code generated by mockery v2.15.0. DO NOT EDIT.
|
|
|
|
package multilimiter
|
|
|
|
import (
|
|
context "context"
|
|
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// MockRateLimiter is an autogenerated mock type for the RateLimiter type
|
|
type MockRateLimiter struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// Allow provides a mock function with given fields: entity
|
|
func (_m *MockRateLimiter) Allow(entity LimitedEntity) bool {
|
|
ret := _m.Called(entity)
|
|
|
|
var r0 bool
|
|
if rf, ok := ret.Get(0).(func(LimitedEntity) bool); ok {
|
|
r0 = rf(entity)
|
|
} else {
|
|
r0 = ret.Get(0).(bool)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Run provides a mock function with given fields: ctx
|
|
func (_m *MockRateLimiter) Run(ctx context.Context) {
|
|
_m.Called(ctx)
|
|
}
|
|
|
|
// UpdateConfig provides a mock function with given fields: c, prefix
|
|
func (_m *MockRateLimiter) UpdateConfig(c LimiterConfig, prefix []byte) {
|
|
_m.Called(c, prefix)
|
|
}
|
|
|
|
type mockConstructorTestingTNewMockRateLimiter interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}
|
|
|
|
// NewMockRateLimiter creates a new instance of MockRateLimiter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
|
func NewMockRateLimiter(t mockConstructorTestingTNewMockRateLimiter) *MockRateLimiter {
|
|
mock := &MockRateLimiter{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|