testing

package
v1.10.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 43 Imported by: 2

Documentation

Overview

Package testing is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFreePorts added in v1.5.0

func GetFreePorts(num uint) ([]int, error)

GetFreePorts asks the kernel for `num` free open ports that are ready to use. This code is retrofitted from freeport.GetFreePort().

func WaitForListeningAddress added in v1.5.0

func WaitForListeningAddress(t *testing.T, timeout time.Duration, addresses ...string)

WaitForListeningAddress waits for `addresses` to be listening for up to `timeout`.

Types

type Event

type Event struct {
	EventName   string        `json:"eventName,omitempty"`
	To          []string      `json:"to,omitempty"`
	Concurrency string        `json:"concurrency,omitempty"`
	CreatedAt   time.Time     `json:"createdAt,omitempty"`
	State       []KeyValState `json:"state,omitempty"`
	Data        interface{}   `json:"data,omitempty"`
}

Event is an app response event.

type FailingAppChannel added in v1.7.0

type FailingAppChannel struct {
	Failure Failure
	KeyFunc func(req *invokev1.InvokeMethodRequest) string
}

func (*FailingAppChannel) GetAppConfig added in v1.7.0

func (f *FailingAppChannel) GetAppConfig() (*config.ApplicationConfig, error)

func (*FailingAppChannel) HealthProbe added in v1.9.0

func (f *FailingAppChannel) HealthProbe(ctx context.Context) (bool, error)

func (*FailingAppChannel) InvokeMethod added in v1.7.0

func (*FailingAppChannel) SetAppHealth added in v1.9.0

func (f *FailingAppChannel) SetAppHealth(ah *apphealth.AppHealth)

type FailingBinding added in v1.7.0

type FailingBinding struct {
	Failure Failure
}

func (*FailingBinding) Close added in v1.7.0

func (m *FailingBinding) Close() error

func (*FailingBinding) GetComponentMetadata added in v1.10.0

func (m *FailingBinding) GetComponentMetadata() map[string]string

func (*FailingBinding) Init added in v1.7.0

func (m *FailingBinding) Init(metadata bindings.Metadata) error

Init is a mock initialization method.

func (*FailingBinding) Invoke added in v1.7.0

Invoke is a mock invoke method.

func (*FailingBinding) Operations added in v1.7.0

func (m *FailingBinding) Operations() []bindings.OperationKind

Operations is a mock operations method.

type FailingConfigurationStore added in v1.7.0

type FailingConfigurationStore struct {
	Failure Failure
}

func (*FailingConfigurationStore) Get added in v1.7.0

func (*FailingConfigurationStore) Init added in v1.7.0

func (*FailingConfigurationStore) Subscribe added in v1.7.0

func (*FailingConfigurationStore) Unsubscribe added in v1.7.0

type FailingDirectMessaging added in v1.7.0

type FailingDirectMessaging struct {
	Failure           Failure
	SuccessStatusCode int
}

func (*FailingDirectMessaging) Invoke added in v1.7.0

func (*FailingDirectMessaging) SetAppChannel added in v1.10.0

func (f *FailingDirectMessaging) SetAppChannel(appChannel channel.AppChannel)

type FailingPubsub added in v1.7.0

type FailingPubsub struct {
	Failure Failure
}

FailingPubsub is a mock pubsub component object that simulates failures.

func (*FailingPubsub) BulkPublish added in v1.10.0

func (*FailingPubsub) BulkSubscribe added in v1.10.0

func (*FailingPubsub) Close added in v1.7.0

func (f *FailingPubsub) Close() error

func (*FailingPubsub) Features added in v1.7.0

func (f *FailingPubsub) Features() []pubsub.Feature

func (*FailingPubsub) GetComponentMetadata added in v1.10.0

func (f *FailingPubsub) GetComponentMetadata() map[string]string

func (*FailingPubsub) Init added in v1.7.0

func (f *FailingPubsub) Init(metadata pubsub.Metadata) error

func (*FailingPubsub) Publish added in v1.7.0

func (f *FailingPubsub) Publish(ctx context.Context, req *pubsub.PublishRequest) error

func (*FailingPubsub) Subscribe added in v1.7.0

func (f *FailingPubsub) Subscribe(_ context.Context, req pubsub.SubscribeRequest, handler pubsub.Handler) error

type FailingSecretStore added in v1.7.0

type FailingSecretStore struct {
	Failure Failure
}

func (FailingSecretStore) BulkGetSecret added in v1.7.0

func (FailingSecretStore) Close added in v1.7.0

func (c FailingSecretStore) Close() error

func (FailingSecretStore) Features added in v1.9.0

func (c FailingSecretStore) Features() []secretstores.Feature

func (FailingSecretStore) GetComponentMetadata added in v1.10.0

func (c FailingSecretStore) GetComponentMetadata() map[string]string

func (FailingSecretStore) GetSecret added in v1.7.0

func (FailingSecretStore) Init added in v1.7.0

func (c FailingSecretStore) Init(metadata secretstores.Metadata) error

type FailingStatestore added in v1.7.0

type FailingStatestore struct {
	Failure     Failure
	BulkFailKey string
}

func (*FailingStatestore) BulkDelete added in v1.7.0

func (f *FailingStatestore) BulkDelete(ctx context.Context, req []state.DeleteRequest) error

func (*FailingStatestore) BulkGet added in v1.7.0

func (*FailingStatestore) BulkSet added in v1.7.0

func (f *FailingStatestore) BulkSet(ctx context.Context, req []state.SetRequest) error

func (*FailingStatestore) Close added in v1.7.0

func (f *FailingStatestore) Close() error

func (*FailingStatestore) Delete added in v1.7.0

func (*FailingStatestore) Features added in v1.7.0

func (f *FailingStatestore) Features() []state.Feature

func (*FailingStatestore) Get added in v1.7.0

func (*FailingStatestore) GetComponentMetadata added in v1.10.0

func (f *FailingStatestore) GetComponentMetadata() map[string]string

func (*FailingStatestore) Init added in v1.7.0

func (f *FailingStatestore) Init(metadata state.Metadata) error

func (*FailingStatestore) Multi added in v1.7.0

func (*FailingStatestore) Ping added in v1.7.0

func (f *FailingStatestore) Ping() error

func (*FailingStatestore) Query added in v1.7.0

func (*FailingStatestore) Set added in v1.7.0

type Failure added in v1.7.0

type Failure struct {
	// contains filtered or unexported fields
}

func NewFailure added in v1.9.0

func NewFailure(fails map[string]int, timeouts map[string]time.Duration, callCount map[string]int) Failure

func (*Failure) CallCount added in v1.7.0

func (f *Failure) CallCount(key string) int

func (*Failure) PerformFailure added in v1.7.0

func (f *Failure) PerformFailure(key string) error

type FakeSecretStore added in v0.11.0

type FakeSecretStore struct{}

func (FakeSecretStore) BulkGetSecret added in v1.0.0

func (FakeSecretStore) Close added in v1.2.0

func (c FakeSecretStore) Close() error

func (FakeSecretStore) Features added in v1.9.0

func (c FakeSecretStore) Features() []secretstores.Feature

func (FakeSecretStore) GetComponentMetadata added in v1.10.0

func (c FakeSecretStore) GetComponentMetadata() map[string]string

func (FakeSecretStore) GetSecret added in v0.11.0

func (FakeSecretStore) Init added in v0.11.0

func (c FakeSecretStore) Init(metadata secretstores.Metadata) error

type InMemoryPubsub added in v1.9.0

type InMemoryPubsub struct {
	mock.Mock
	// contains filtered or unexported fields
}

InMemoryPubsub is a mock pub-sub component object that works with in-memory handlers

func (*InMemoryPubsub) BulkPublish added in v1.10.0

func (*InMemoryPubsub) BulkSubscribe added in v1.10.0

func (*InMemoryPubsub) Close added in v1.9.0

func (m *InMemoryPubsub) Close() error

Close is a mock close method.

func (*InMemoryPubsub) Features added in v1.9.0

func (m *InMemoryPubsub) Features() []pubsub.Feature

func (*InMemoryPubsub) Init added in v1.9.0

func (m *InMemoryPubsub) Init(metadata pubsub.Metadata) error

Init is a mock initialization method.

func (*InMemoryPubsub) Publish added in v1.9.0

func (m *InMemoryPubsub) Publish(ctx context.Context, req *pubsub.PublishRequest) error

Publish is a mock publish method.

func (*InMemoryPubsub) SetBulkHandler added in v1.10.0

func (m *InMemoryPubsub) SetBulkHandler(h func(topic string, msg *pubsub.BulkMessage))

func (*InMemoryPubsub) SetHandler added in v1.9.0

func (m *InMemoryPubsub) SetHandler(h func(topic string, msg *pubsub.NewMessage))

func (*InMemoryPubsub) SetOnSubscribedTopicsChanged added in v1.9.0

func (m *InMemoryPubsub) SetOnSubscribedTopicsChanged(f func([]string))

func (*InMemoryPubsub) Subscribe added in v1.9.0

func (m *InMemoryPubsub) Subscribe(parentCtx context.Context, req pubsub.SubscribeRequest, handler pubsub.Handler) error

Subscribe is a mock subscribe method.

type KeyValState

type KeyValState struct {
	Key   string      `json:"key"`
	Value interface{} `json:"value"`
}

KeyValState is a key value struct for state.

type MockApp

type MockApp struct {
	// contains filtered or unexported fields
}

MockApp is a mock for an app.

func NewMockApp

func NewMockApp(returnBody bool, messageCount int, noprint bool) *MockApp

NewMockApp returns a new mocked app.

func (*MockApp) Run

func (a *MockApp) Run(port int)

Run opens a test HTTP server and echo endpoint on the mock object.

type MockBinding added in v1.0.0

type MockBinding struct {
	mock.Mock
	// contains filtered or unexported fields
}

MockBinding is a mock input/output component object.

func (*MockBinding) Close added in v1.2.0

func (m *MockBinding) Close() error

func (*MockBinding) GetComponentMetadata added in v1.10.0

func (m *MockBinding) GetComponentMetadata() map[string]string

func (*MockBinding) Init added in v1.0.0

func (m *MockBinding) Init(metadata bindings.Metadata) error

Init is a mock initialization method.

func (*MockBinding) Invoke added in v1.0.0

Invoke is a mock invoke method.

func (*MockBinding) Operations added in v1.0.0

func (m *MockBinding) Operations() []bindings.OperationKind

Operations is a mock operations method.

func (*MockBinding) Read added in v1.0.0

func (m *MockBinding) Read(ctx context.Context, handler bindings.Handler) error

Read is a mock read method.

func (*MockBinding) SetOnReadCloseCh added in v1.9.0

func (m *MockBinding) SetOnReadCloseCh(ch chan struct{})

type MockConfigurationStore added in v1.7.0

type MockConfigurationStore struct {
	mock.Mock
}

MockConfigurationStore is an autogenerated mock type for the Store type

func (*MockConfigurationStore) Get added in v1.7.0

Get provides a mock function with given fields: ctx, req

func (*MockConfigurationStore) Init added in v1.7.0

Init provides a mock function with given fields: metadata

func (*MockConfigurationStore) Subscribe added in v1.7.0

Subscribe provides a mock function with given fields: ctx, req, handler

func (*MockConfigurationStore) Unsubscribe added in v1.7.0

Unsubscribe provides a mock function with given fields: ctx, req

type MockDirectMessaging

type MockDirectMessaging struct {
	mock.Mock
}

MockDirectMessaging is an autogenerated mock type for the MockDirectMessaging type

func (*MockDirectMessaging) Close added in v1.2.0

func (_m *MockDirectMessaging) Close() error

func (*MockDirectMessaging) Invoke

Invoke provides a mock function with given fields: ctx, targetAppID, req

func (*MockDirectMessaging) SetAppChannel added in v1.10.0

func (_m *MockDirectMessaging) SetAppChannel(appChannel channel.AppChannel)

type MockFieldIndexer added in v1.6.0

type MockFieldIndexer struct {
	// contains filtered or unexported fields
}

func (*MockFieldIndexer) IndexField added in v1.6.0

func (t *MockFieldIndexer) IndexField(ctx context.Context, obj client.Object, field string, extractValue client.IndexerFunc) error

type MockManager added in v1.6.0

type MockManager struct {
	// contains filtered or unexported fields
}

func NewMockManager added in v1.6.0

func NewMockManager() *MockManager

func (*MockManager) Add added in v1.6.0

func (m *MockManager) Add(runnable manager.Runnable) error

func (*MockManager) AddHealthzCheck added in v1.6.0

func (m *MockManager) AddHealthzCheck(name string, check healthz.Checker) error

func (*MockManager) AddMetricsExtraHandler added in v1.6.0

func (m *MockManager) AddMetricsExtraHandler(path string, handler http.Handler) error

func (*MockManager) AddReadyzCheck added in v1.6.0

func (m *MockManager) AddReadyzCheck(name string, check healthz.Checker) error

func (*MockManager) Elected added in v1.6.0

func (m *MockManager) Elected() <-chan struct{}

func (*MockManager) GetAPIReader added in v1.6.0

func (m *MockManager) GetAPIReader() client.Reader

func (*MockManager) GetCache added in v1.6.0

func (m *MockManager) GetCache() cache.Cache

func (*MockManager) GetClient added in v1.6.0

func (m *MockManager) GetClient() client.Client

func (*MockManager) GetConfig added in v1.6.0

func (m *MockManager) GetConfig() *rest.Config

func (*MockManager) GetControllerOptions added in v1.7.0

func (m *MockManager) GetControllerOptions() v1alpha1.ControllerConfigurationSpec

func (*MockManager) GetEventRecorderFor added in v1.6.0

func (m *MockManager) GetEventRecorderFor(name string) record.EventRecorder

func (*MockManager) GetFieldIndexer added in v1.6.0

func (m *MockManager) GetFieldIndexer() client.FieldIndexer

func (*MockManager) GetIndexerFunc added in v1.6.0

func (m *MockManager) GetIndexerFunc(obj client.Object) client.IndexerFunc

func (*MockManager) GetLogger added in v1.6.0

func (m *MockManager) GetLogger() logr.Logger

func (*MockManager) GetRESTMapper added in v1.6.0

func (m *MockManager) GetRESTMapper() meta.RESTMapper

func (*MockManager) GetRunnables added in v1.6.0

func (m *MockManager) GetRunnables() []manager.Runnable

func (*MockManager) GetScheme added in v1.6.0

func (m *MockManager) GetScheme() *runtime.Scheme

func (*MockManager) GetWebhookServer added in v1.6.0

func (m *MockManager) GetWebhookServer() *webhook.Server

func (*MockManager) SetFields added in v1.6.0

func (m *MockManager) SetFields(interface{}) error

func (*MockManager) Start added in v1.6.0

func (m *MockManager) Start(ctx context.Context) error

type MockPubSub

type MockPubSub struct {
	mock.Mock
}

MockPubSub is a mock pub-sub component object.

func (*MockPubSub) BulkPublish added in v1.10.0

BulkPublish is a mock bulk publish method.

func (*MockPubSub) BulkSubscribe added in v1.10.0

BulkSubscribe is a mock bulk subscribe method.

func (*MockPubSub) Close added in v1.0.0

func (m *MockPubSub) Close() error

Close is a mock close method.

func (*MockPubSub) Features added in v1.0.0

func (m *MockPubSub) Features() []pubsub.Feature

func (*MockPubSub) GetComponentMetadata added in v1.10.0

func (m *MockPubSub) GetComponentMetadata() map[string]string

func (*MockPubSub) Init

func (m *MockPubSub) Init(metadata pubsub.Metadata) error

Init is a mock initialization method.

func (*MockPubSub) Publish

func (m *MockPubSub) Publish(ctx context.Context, req *pubsub.PublishRequest) error

Publish is a mock publish method.

func (*MockPubSub) Subscribe

func (m *MockPubSub) Subscribe(_ context.Context, req pubsub.SubscribeRequest, handler pubsub.Handler) error

Subscribe is a mock subscribe method.

type MockPubSubAdapter added in v1.0.0

type MockPubSubAdapter struct {
	PublishFn     func(req *pubsub.PublishRequest) error
	BulkPublishFn func(req *pubsub.BulkPublishRequest) (pubsub.BulkPublishResponse, error)
	GetPubSubFn   func(pubsubName string) pubsub.PubSub
}

MockPubSubAdapter is mock for PubSubAdapter

func (*MockPubSubAdapter) BulkPublish added in v1.10.0

Publish is an adapter method for the runtime to pre-validate publish requests And then forward them to the Pub/Sub component. This method is used by the HTTP and gRPC APIs.

func (*MockPubSubAdapter) GetPubSub added in v1.0.0

func (a *MockPubSubAdapter) GetPubSub(pubsubName string) pubsub.PubSub

GetPubSub is an adapter method to fetch a pubsub

func (*MockPubSubAdapter) Publish added in v1.0.0

func (a *MockPubSubAdapter) Publish(req *pubsub.PublishRequest) error

Publish is an adapter method for the runtime to pre-validate publish requests And then forward them to the Pub/Sub component. This method is used by the HTTP and gRPC APIs.

type MockQuerier added in v1.5.0

type MockQuerier struct {
	mock.Mock
}

MockQuerier is an autogenerated mock type for the Querier type

func (*MockQuerier) Query added in v1.5.0

Query provides a mock function with given fields: req

type MockResolver added in v1.2.0

type MockResolver struct {
	mock.Mock
}

MockResolver is a mock nameresolution component object.

func (*MockResolver) Init added in v1.2.0

func (m *MockResolver) Init(metadata nr.Metadata) error

Init is a mock initialization method.

func (*MockResolver) ResolveID added in v1.2.0

func (m *MockResolver) ResolveID(req nr.ResolveRequest) (string, error)

ResolveID is a mock resolve method.

type MockStateStore added in v1.0.0

type MockStateStore struct {
	mock.Mock
}

MockStateStore is an autogenerated mock type for the Store type

func (*MockStateStore) BulkDelete added in v1.0.0

func (_m *MockStateStore) BulkDelete(ctx context.Context, req []state.DeleteRequest) error

BulkDelete provides a mock function with given fields: req

func (*MockStateStore) BulkGet added in v1.0.0

func (*MockStateStore) BulkSet added in v1.0.0

func (_m *MockStateStore) BulkSet(ctx context.Context, req []state.SetRequest) error

BulkSet provides a mock function with given fields: req

func (*MockStateStore) Close added in v1.2.0

func (_m *MockStateStore) Close() error

func (*MockStateStore) Delete added in v1.0.0

func (_m *MockStateStore) Delete(ctx context.Context, req *state.DeleteRequest) error

Delete provides a mock function with given fields: req

func (*MockStateStore) Features added in v1.1.0

func (_m *MockStateStore) Features() []state.Feature

Features returns the features for this state store.

func (*MockStateStore) Get added in v1.0.0

Get provides a mock function with given fields: req

func (*MockStateStore) GetComponentMetadata added in v1.10.0

func (f *MockStateStore) GetComponentMetadata() map[string]string

func (*MockStateStore) Init added in v1.0.0

func (_m *MockStateStore) Init(metadata state.Metadata) error

Init provides a mock function with given fields: metadata

func (*MockStateStore) Ping added in v1.3.0

func (_m *MockStateStore) Ping() error

Ping provides a mock function

func (*MockStateStore) Set added in v1.0.0

func (_m *MockStateStore) Set(ctx context.Context, req *state.SetRequest) error

Set provides a mock function with given fields: req

type MockStore added in v1.8.0

type MockStore struct {
	// contains filtered or unexported fields
}

MockStore is a mock of Store interface.

func NewMockStore added in v1.8.0

func NewMockStore(ctrl *gomock.Controller) *MockStore

NewMockStore creates a new mock instance.

func (*MockStore) EXPECT added in v1.8.0

func (m *MockStore) EXPECT() *MockStoreMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockStore) InitLockStore added in v1.8.0

func (m *MockStore) InitLockStore(metadata lock.Metadata) error

InitLockStore mocks base method.

func (*MockStore) TryLock added in v1.8.0

TryLock mocks base method.

func (*MockStore) Unlock added in v1.8.0

Unlock mocks base method.

type MockStoreMockRecorder added in v1.8.0

type MockStoreMockRecorder struct {
	// contains filtered or unexported fields
}

MockStoreMockRecorder is the mock recorder for MockStore.

func (*MockStoreMockRecorder) InitLockStore added in v1.8.0

func (mr *MockStoreMockRecorder) InitLockStore(metadata interface{}) *gomock.Call

InitLockStore indicates an expected call of InitLockStore.

func (*MockStoreMockRecorder) TryLock added in v1.8.0

func (mr *MockStoreMockRecorder) TryLock(ctx context.Context, req interface{}) *gomock.Call

TryLock indicates an expected call of TryLock.

func (*MockStoreMockRecorder) Unlock added in v1.8.0

func (mr *MockStoreMockRecorder) Unlock(ctx context.Context, req interface{}) *gomock.Call

Unlock indicates an expected call of Unlock.

type TransactionalStoreMock added in v1.0.0

type TransactionalStoreMock struct {
	MockStateStore
}

func (*TransactionalStoreMock) Close added in v1.2.0

func (storeMock *TransactionalStoreMock) Close() error

func (*TransactionalStoreMock) Features added in v1.1.0

func (storeMock *TransactionalStoreMock) Features() []state.Feature

func (*TransactionalStoreMock) Multi added in v1.0.0

Code generated by mockery v2.3.0. DO NOT EDIT.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL