a6a6d5a8ee
OSS port of enterprise PR 1822 Includes the necessary changes to the `proxycfg` and `xds` packages to enable Consul servers to configure arbitrary proxies using catalog data. Broadly, `proxycfg.Manager` now has public methods for registering, deregistering, and listing registered proxies — the existing local agent state-sync behavior has been moved into a separate component that makes use of these methods. When an xDS session is started for a proxy service in the catalog, a goroutine will be spawned to watch the service in the server's state store and re-register it with the `proxycfg.Manager` whenever it is updated (and clean it up when the client goes away).
60 lines
1.6 KiB
Go
60 lines
1.6 KiB
Go
// Code generated by mockery v2.12.0. DO NOT EDIT.
|
|
|
|
package catalog
|
|
|
|
import (
|
|
proxycfg "github.com/hashicorp/consul/agent/proxycfg"
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
structs "github.com/hashicorp/consul/agent/structs"
|
|
|
|
testing "testing"
|
|
)
|
|
|
|
// 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, 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 proxycfg.CancelFunc
|
|
if rf, ok := ret.Get(1).(func(structs.ServiceID, string, string) proxycfg.CancelFunc); ok {
|
|
r1 = rf(proxyID, nodeName, token)
|
|
} else {
|
|
if ret.Get(1) != nil {
|
|
r1 = ret.Get(1).(proxycfg.CancelFunc)
|
|
}
|
|
}
|
|
|
|
var r2 error
|
|
if rf, ok := ret.Get(2).(func(structs.ServiceID, string, string) error); ok {
|
|
r2 = rf(proxyID, nodeName, token)
|
|
} else {
|
|
r2 = ret.Error(2)
|
|
}
|
|
|
|
return r0, r1, r2
|
|
}
|
|
|
|
// NewMockWatcher creates a new instance of MockWatcher. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations.
|
|
func NewMockWatcher(t testing.TB) *MockWatcher {
|
|
mock := &MockWatcher{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|