Versions in this module Expand all Collapse all v0 v0.14.0 Apr 24, 2024 v0.13.0 Feb 27, 2024 Changes in this version + func MockServices(client *ClientMock, services map[string][]*discovery.Instance) (err error) + func MockServicesFromFile(client *ClientMock, fsys fs.FS, path string) error + func MockServicesFromProperties(client *ClientMock, appCfg bootstrap.ApplicationConfig, prefix string) error + func SetupServicesWithFile(di *DI, fsys fs.FS, path string) test.SetupFunc + func SetupServicesWithProperties(di *DI, prefix string) test.SetupFunc + func WithMockedSD(opts ...SDMockOptions) test.Options + type ClientMock struct + Instancers map[string]*InstancerMock + func NewMockClient(ctx context.Context) *ClientMock + func ProvideDiscoveryClient(ctx *bootstrap.ApplicationContext) (discovery.Client, *ClientMock) + func (c *ClientMock) Context() context.Context + func (c *ClientMock) Instancer(serviceName string) (discovery.Instancer, error) + func (c *ClientMock) MockError(svcName string, what error, when time.Time) + func (c *ClientMock) MockService(svcName string, count int, opts ...InstanceMockOptions) []*discovery.Instance + func (c *ClientMock) UpdateMockedService(svcName string, matcher InstanceMockMatcher, opts ...InstanceMockOptions) (count int) + type DI struct + AppCtx *bootstrap.ApplicationContext + Client *ClientMock + type InstanceMockMatcher func(inst *discovery.Instance) bool + func AnyInstance() InstanceMockMatcher + func InstanceAfterN(n int) InstanceMockMatcher + func NthInstance(n int) InstanceMockMatcher + type InstanceMockOptions func(inst *discovery.Instance) + func BeCritical() InstanceMockOptions + func BeHealthy() InstanceMockOptions + func WithExtraTag(tags ...string) InstanceMockOptions + func WithMeta(k, v string) InstanceMockOptions + type InstancerMock struct + ErrMock error + ErrTimeMock time.Time + InstanceMocks []*discovery.Instance + SName string + Started bool + func NewMockInstancer(ctx context.Context, svcName string) *InstancerMock + func (i *InstancerMock) DeregisterCallback(_ interface{}) + func (i *InstancerMock) Instances(matcher discovery.InstanceMatcher) ([]*discovery.Instance, error) + func (i *InstancerMock) MockError(what error, when time.Time) + func (i *InstancerMock) MockInstances(count int, opts ...InstanceMockOptions) []*discovery.Instance + func (i *InstancerMock) RegisterCallback(_ interface{}, _ discovery.Callback) + func (i *InstancerMock) Service() *discovery.Service + func (i *InstancerMock) ServiceName() string + func (i *InstancerMock) Start(_ context.Context) + func (i *InstancerMock) Stop() + func (i *InstancerMock) UpdateInstances(matcher InstanceMockMatcher, opts ...InstanceMockOptions) (count int) + type SDMockOption struct + DefPath string + FS fs.FS + PropertiesPrefix string + type SDMockOptions func(opt *SDMockOption) + func DefinitionWithPrefix(prefix string) SDMockOptions + func LoadDefinition(fsys fs.FS, path string) SDMockOptions