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
74 lines
2.1 KiB
Go
74 lines
2.1 KiB
Go
// Code generated by mockery v2.15.0. DO NOT EDIT.
|
|
|
|
package catalog
|
|
|
|
import (
|
|
limiter "github.com/hashicorp/consul/agent/grpc-external/limiter"
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
proxycfg "github.com/hashicorp/consul/agent/proxycfg"
|
|
|
|
structs "github.com/hashicorp/consul/agent/structs"
|
|
)
|
|
|
|
// MockWatcher is an autogenerated mock type for the Watcher type
|
|
type MockWatcher struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// Watch provides a mock function with given fields: proxyID, nodeName, token
|
|
func (_m *MockWatcher) Watch(proxyID structs.ServiceID, nodeName string, token string) (<-chan *proxycfg.ConfigSnapshot, limiter.SessionTerminatedChan, proxycfg.CancelFunc, error) {
|
|
ret := _m.Called(proxyID, nodeName, token)
|
|
|
|
var r0 <-chan *proxycfg.ConfigSnapshot
|
|
if rf, ok := ret.Get(0).(func(structs.ServiceID, string, string) <-chan *proxycfg.ConfigSnapshot); ok {
|
|
r0 = rf(proxyID, nodeName, token)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(<-chan *proxycfg.ConfigSnapshot)
|
|
}
|
|
}
|
|
|
|
var r1 limiter.SessionTerminatedChan
|
|
if rf, ok := ret.Get(1).(func(structs.ServiceID, string, string) limiter.SessionTerminatedChan); ok {
|
|
r1 = rf(proxyID, nodeName, token)
|
|
} else {
|
|
if ret.Get(1) != nil {
|
|
r1 = ret.Get(1).(limiter.SessionTerminatedChan)
|
|
}
|
|
}
|
|
|
|
var r2 proxycfg.CancelFunc
|
|
if rf, ok := ret.Get(2).(func(structs.ServiceID, string, string) proxycfg.CancelFunc); ok {
|
|
r2 = rf(proxyID, nodeName, token)
|
|
} else {
|
|
if ret.Get(2) != nil {
|
|
r2 = ret.Get(2).(proxycfg.CancelFunc)
|
|
}
|
|
}
|
|
|
|
var r3 error
|
|
if rf, ok := ret.Get(3).(func(structs.ServiceID, string, string) error); ok {
|
|
r3 = rf(proxyID, nodeName, token)
|
|
} else {
|
|
r3 = ret.Error(3)
|
|
}
|
|
|
|
return r0, r1, r2, r3
|
|
}
|
|
|
|
type mockConstructorTestingTNewMockWatcher interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}
|
|
|
|
// NewMockWatcher creates a new instance of MockWatcher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
|
func NewMockWatcher(t mockConstructorTestingTNewMockWatcher) *MockWatcher {
|
|
mock := &MockWatcher{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|