618deae657
Previously, we'd begin a session with the xDS concurrency limiter regardless of whether the proxy was registered in the catalog or in the server's local agent state. This caused problems for users who run `consul connect envoy` directly against a server rather than a client agent, as the server's locally registered proxies wouldn't be included in the limiter's capacity. Now, the `ConfigSource` is responsible for beginning the session and we only do so for services in the catalog. Fixes: https://github.com/hashicorp/consul/issues/15753
91 lines
2.6 KiB
Go
91 lines
2.6 KiB
Go
// Code generated by mockery v2.15.0. DO NOT EDIT.
|
|
|
|
package local
|
|
|
|
import (
|
|
proxycfg "github.com/hashicorp/consul/agent/proxycfg"
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
structs "github.com/hashicorp/consul/agent/structs"
|
|
)
|
|
|
|
// MockConfigManager is an autogenerated mock type for the ConfigManager type
|
|
type MockConfigManager struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// Deregister provides a mock function with given fields: proxyID, source
|
|
func (_m *MockConfigManager) Deregister(proxyID proxycfg.ProxyID, source proxycfg.ProxySource) {
|
|
_m.Called(proxyID, source)
|
|
}
|
|
|
|
// Register provides a mock function with given fields: proxyID, service, source, token, overwrite
|
|
func (_m *MockConfigManager) Register(proxyID proxycfg.ProxyID, service *structs.NodeService, source proxycfg.ProxySource, token string, overwrite bool) error {
|
|
ret := _m.Called(proxyID, service, source, token, overwrite)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(proxycfg.ProxyID, *structs.NodeService, proxycfg.ProxySource, string, bool) error); ok {
|
|
r0 = rf(proxyID, service, source, token, overwrite)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// RegisteredProxies provides a mock function with given fields: source
|
|
func (_m *MockConfigManager) RegisteredProxies(source proxycfg.ProxySource) []proxycfg.ProxyID {
|
|
ret := _m.Called(source)
|
|
|
|
var r0 []proxycfg.ProxyID
|
|
if rf, ok := ret.Get(0).(func(proxycfg.ProxySource) []proxycfg.ProxyID); ok {
|
|
r0 = rf(source)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]proxycfg.ProxyID)
|
|
}
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Watch provides a mock function with given fields: id
|
|
func (_m *MockConfigManager) Watch(id proxycfg.ProxyID) (<-chan *proxycfg.ConfigSnapshot, proxycfg.CancelFunc) {
|
|
ret := _m.Called(id)
|
|
|
|
var r0 <-chan *proxycfg.ConfigSnapshot
|
|
if rf, ok := ret.Get(0).(func(proxycfg.ProxyID) <-chan *proxycfg.ConfigSnapshot); ok {
|
|
r0 = rf(id)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(<-chan *proxycfg.ConfigSnapshot)
|
|
}
|
|
}
|
|
|
|
var r1 proxycfg.CancelFunc
|
|
if rf, ok := ret.Get(1).(func(proxycfg.ProxyID) proxycfg.CancelFunc); ok {
|
|
r1 = rf(id)
|
|
} else {
|
|
if ret.Get(1) != nil {
|
|
r1 = ret.Get(1).(proxycfg.CancelFunc)
|
|
}
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
type mockConstructorTestingTNewMockConfigManager interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}
|
|
|
|
// NewMockConfigManager creates a new instance of MockConfigManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
|
func NewMockConfigManager(t mockConstructorTestingTNewMockConfigManager) *MockConfigManager {
|
|
mock := &MockConfigManager{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|