Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsulCatalog ¶
type ConsulCatalog struct {
// contains filtered or unexported fields
}
ConsulCatalog provider periodically gets consul services with tags, started with 'reproxy.' It stores service list IDs in the internal storage. If service list was changed, it send signal to the core The provider maps services with rules, described in the docker provider documentation
reproxy.route sets source route, and reproxy.dest sets the destination. Optional reproxy.server enforces match by server name (hostname) and reproxy.ping sets the health check url
func New ¶
func New(client ConsulClient, checkInterval time.Duration) *ConsulCatalog
New creates new ConsulCatalog instance
func (*ConsulCatalog) Events ¶
func (cc *ConsulCatalog) Events(ctx context.Context) (res <-chan discovery.ProviderID)
Events gets eventsCh, which emit services list update events
type ConsulClient ¶
type ConsulClient interface {
Get() ([]consulService, error)
}
ConsulClient defines interface getting consul services
func NewClient ¶
func NewClient(address string, httpClient HTTPClient) ConsulClient
NewClient creates new Consul consulClient
type ConsulClientMock ¶
type ConsulClientMock struct { // GetFunc mocks the Get method. GetFunc func() ([]consulService, error) // contains filtered or unexported fields }
ConsulClientMock is a mock implementation of ConsulClient.
func TestSomethingThatUsesConsulClient(t *testing.T) { // make and configure a mocked ConsulClient mockedConsulClient := &ConsulClientMock{ GetFunc: func() ([]consulService, error) { panic("mock out the Get method") }, } // use mockedConsulClient in code that requires ConsulClient // and then make assertions. }
func (*ConsulClientMock) Get ¶
func (mock *ConsulClientMock) Get() ([]consulService, error)
Get calls GetFunc.
func (*ConsulClientMock) GetCalls ¶
func (mock *ConsulClientMock) GetCalls() []struct { }
GetCalls gets all the calls that were made to Get. Check the length with:
len(mockedConsulClient.GetCalls())