fake

package
v0.0.0-...-67b0140 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockManager

type MockManager struct {
	// AddFunc mocks the Add method.
	AddFunc func(runnable manager.Runnable) error

	// AddHealthzCheckFunc mocks the AddHealthzCheck method.
	AddHealthzCheckFunc func(name string, check healthz.Checker) error

	// AddMetricsExtraHandlerFunc mocks the AddMetricsExtraHandler method.
	AddMetricsExtraHandlerFunc func(path string, handler http.Handler) error

	// AddReadyzCheckFunc mocks the AddReadyzCheck method.
	AddReadyzCheckFunc func(name string, check healthz.Checker) error

	// ElectedFunc mocks the Elected method.
	ElectedFunc func() <-chan struct{}

	// GetAPIReaderFunc mocks the GetAPIReader method.
	GetAPIReaderFunc func() client.Reader

	// GetCacheFunc mocks the GetCache method.
	GetCacheFunc func() cache.Cache

	// GetClientFunc mocks the GetClient method.
	GetClientFunc func() client.Client

	// GetConfigFunc mocks the GetConfig method.
	GetConfigFunc func() *rest.Config

	// GetControllerOptionsFunc mocks the GetControllerOptions method.
	GetControllerOptionsFunc func() v1alpha1.ControllerConfigurationSpec

	// GetEventRecorderForFunc mocks the GetEventRecorderFor method.
	GetEventRecorderForFunc func(name string) record.EventRecorder

	// GetFieldIndexerFunc mocks the GetFieldIndexer method.
	GetFieldIndexerFunc func() client.FieldIndexer

	// GetLoggerFunc mocks the GetLogger method.
	GetLoggerFunc func() logr.Logger

	// GetRESTMapperFunc mocks the GetRESTMapper method.
	GetRESTMapperFunc func() meta.RESTMapper

	// GetSchemeFunc mocks the GetScheme method.
	GetSchemeFunc func() *runtime.Scheme

	// GetWebhookServerFunc mocks the GetWebhookServer method.
	GetWebhookServerFunc func() *webhook.Server

	// SetFieldsFunc mocks the SetFields method.
	SetFieldsFunc func(ifaceVal interface{}) error

	// StartFunc mocks the Start method.
	StartFunc func(ctx context.Context) error
	// contains filtered or unexported fields
}

MockManager is a mock implementation of manager.IManager.

func TestSomethingThatUsesIManager(t *testing.T) {

	// make and configure a mocked manager.IManager
	mockedIManager := &MockManager{
		AddFunc: func(runnable manager.Runnable) error {
			panic("mock out the Add method")
		},
		AddHealthzCheckFunc: func(name string, check healthz.Checker) error {
			panic("mock out the AddHealthzCheck method")
		},
		AddMetricsExtraHandlerFunc: func(path string, handler http.Handler) error {
			panic("mock out the AddMetricsExtraHandler method")
		},
		AddReadyzCheckFunc: func(name string, check healthz.Checker) error {
			panic("mock out the AddReadyzCheck method")
		},
		ElectedFunc: func() <-chan struct{} {
			panic("mock out the Elected method")
		},
		GetAPIReaderFunc: func() client.Reader {
			panic("mock out the GetAPIReader method")
		},
		GetCacheFunc: func() cache.Cache {
			panic("mock out the GetCache method")
		},
		GetClientFunc: func() client.Client {
			panic("mock out the GetClient method")
		},
		GetConfigFunc: func() *rest.Config {
			panic("mock out the GetConfig method")
		},
		GetControllerOptionsFunc: func() v1alpha1.ControllerConfigurationSpec {
			panic("mock out the GetControllerOptions method")
		},
		GetEventRecorderForFunc: func(name string) record.EventRecorder {
			panic("mock out the GetEventRecorderFor method")
		},
		GetFieldIndexerFunc: func() client.FieldIndexer {
			panic("mock out the GetFieldIndexer method")
		},
		GetLoggerFunc: func() logr.Logger {
			panic("mock out the GetLogger method")
		},
		GetRESTMapperFunc: func() meta.RESTMapper {
			panic("mock out the GetRESTMapper method")
		},
		GetSchemeFunc: func() *runtime.Scheme {
			panic("mock out the GetScheme method")
		},
		GetWebhookServerFunc: func() *webhook.Server {
			panic("mock out the GetWebhookServer method")
		},
		SetFieldsFunc: func(ifaceVal interface{}) error {
			panic("mock out the SetFields method")
		},
		StartFunc: func(ctx context.Context) error {
			panic("mock out the Start method")
		},
	}

	// use mockedIManager in code that requires manager.IManager
	// and then make assertions.

}

func (*MockManager) Add

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

Add calls AddFunc.

func (*MockManager) AddCalls

func (mock *MockManager) AddCalls() []struct {
	Runnable manager.Runnable
}

AddCalls gets all the calls that were made to Add. Check the length with:

len(mockedIManager.AddCalls())

func (*MockManager) AddHealthzCheck

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

AddHealthzCheck calls AddHealthzCheckFunc.

func (*MockManager) AddHealthzCheckCalls

func (mock *MockManager) AddHealthzCheckCalls() []struct {
	Name  string
	Check healthz.Checker
}

AddHealthzCheckCalls gets all the calls that were made to AddHealthzCheck. Check the length with:

len(mockedIManager.AddHealthzCheckCalls())

func (*MockManager) AddMetricsExtraHandler

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

AddMetricsExtraHandler calls AddMetricsExtraHandlerFunc.

func (*MockManager) AddMetricsExtraHandlerCalls

func (mock *MockManager) AddMetricsExtraHandlerCalls() []struct {
	Path    string
	Handler http.Handler
}

AddMetricsExtraHandlerCalls gets all the calls that were made to AddMetricsExtraHandler. Check the length with:

len(mockedIManager.AddMetricsExtraHandlerCalls())

func (*MockManager) AddReadyzCheck

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

AddReadyzCheck calls AddReadyzCheckFunc.

func (*MockManager) AddReadyzCheckCalls

func (mock *MockManager) AddReadyzCheckCalls() []struct {
	Name  string
	Check healthz.Checker
}

AddReadyzCheckCalls gets all the calls that were made to AddReadyzCheck. Check the length with:

len(mockedIManager.AddReadyzCheckCalls())

func (*MockManager) Elected

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

Elected calls ElectedFunc.

func (*MockManager) ElectedCalls

func (mock *MockManager) ElectedCalls() []struct {
}

ElectedCalls gets all the calls that were made to Elected. Check the length with:

len(mockedIManager.ElectedCalls())

func (*MockManager) GetAPIReader

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

GetAPIReader calls GetAPIReaderFunc.

func (*MockManager) GetAPIReaderCalls

func (mock *MockManager) GetAPIReaderCalls() []struct {
}

GetAPIReaderCalls gets all the calls that were made to GetAPIReader. Check the length with:

len(mockedIManager.GetAPIReaderCalls())

func (*MockManager) GetCache

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

GetCache calls GetCacheFunc.

func (*MockManager) GetCacheCalls

func (mock *MockManager) GetCacheCalls() []struct {
}

GetCacheCalls gets all the calls that were made to GetCache. Check the length with:

len(mockedIManager.GetCacheCalls())

func (*MockManager) GetClient

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

GetClient calls GetClientFunc.

func (*MockManager) GetClientCalls

func (mock *MockManager) GetClientCalls() []struct {
}

GetClientCalls gets all the calls that were made to GetClient. Check the length with:

len(mockedIManager.GetClientCalls())

func (*MockManager) GetConfig

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

GetConfig calls GetConfigFunc.

func (*MockManager) GetConfigCalls

func (mock *MockManager) GetConfigCalls() []struct {
}

GetConfigCalls gets all the calls that were made to GetConfig. Check the length with:

len(mockedIManager.GetConfigCalls())

func (*MockManager) GetControllerOptions

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

GetControllerOptions calls GetControllerOptionsFunc.

func (*MockManager) GetControllerOptionsCalls

func (mock *MockManager) GetControllerOptionsCalls() []struct {
}

GetControllerOptionsCalls gets all the calls that were made to GetControllerOptions. Check the length with:

len(mockedIManager.GetControllerOptionsCalls())

func (*MockManager) GetEventRecorderFor

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

GetEventRecorderFor calls GetEventRecorderForFunc.

func (*MockManager) GetEventRecorderForCalls

func (mock *MockManager) GetEventRecorderForCalls() []struct {
	Name string
}

GetEventRecorderForCalls gets all the calls that were made to GetEventRecorderFor. Check the length with:

len(mockedIManager.GetEventRecorderForCalls())

func (*MockManager) GetFieldIndexer

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

GetFieldIndexer calls GetFieldIndexerFunc.

func (*MockManager) GetFieldIndexerCalls

func (mock *MockManager) GetFieldIndexerCalls() []struct {
}

GetFieldIndexerCalls gets all the calls that were made to GetFieldIndexer. Check the length with:

len(mockedIManager.GetFieldIndexerCalls())

func (*MockManager) GetLogger

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

GetLogger calls GetLoggerFunc.

func (*MockManager) GetLoggerCalls

func (mock *MockManager) GetLoggerCalls() []struct {
}

GetLoggerCalls gets all the calls that were made to GetLogger. Check the length with:

len(mockedIManager.GetLoggerCalls())

func (*MockManager) GetRESTMapper

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

GetRESTMapper calls GetRESTMapperFunc.

func (*MockManager) GetRESTMapperCalls

func (mock *MockManager) GetRESTMapperCalls() []struct {
}

GetRESTMapperCalls gets all the calls that were made to GetRESTMapper. Check the length with:

len(mockedIManager.GetRESTMapperCalls())

func (*MockManager) GetScheme

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

GetScheme calls GetSchemeFunc.

func (*MockManager) GetSchemeCalls

func (mock *MockManager) GetSchemeCalls() []struct {
}

GetSchemeCalls gets all the calls that were made to GetScheme. Check the length with:

len(mockedIManager.GetSchemeCalls())

func (*MockManager) GetWebhookServer

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

GetWebhookServer calls GetWebhookServerFunc.

func (*MockManager) GetWebhookServerCalls

func (mock *MockManager) GetWebhookServerCalls() []struct {
}

GetWebhookServerCalls gets all the calls that were made to GetWebhookServer. Check the length with:

len(mockedIManager.GetWebhookServerCalls())

func (*MockManager) SetFields

func (mock *MockManager) SetFields(ifaceVal interface{}) error

SetFields calls SetFieldsFunc.

func (*MockManager) SetFieldsCalls

func (mock *MockManager) SetFieldsCalls() []struct {
	IfaceVal interface{}
}

SetFieldsCalls gets all the calls that were made to SetFields. Check the length with:

len(mockedIManager.SetFieldsCalls())

func (*MockManager) Start

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

Start calls StartFunc.

func (*MockManager) StartCalls

func (mock *MockManager) StartCalls() []struct {
	Ctx context.Context
}

StartCalls gets all the calls that were made to Start. Check the length with:

len(mockedIManager.StartCalls())

type MockProvider

type MockProvider struct {
	// GetConfigFunc mocks the GetConfig method.
	GetConfigFunc func() (*rest.Config, error)
	// contains filtered or unexported fields
}

MockProvider is a mock implementation of config.Provider.

func TestSomethingThatUsesProvider(t *testing.T) {

	// make and configure a mocked config.Provider
	mockedProvider := &MockProvider{
		GetConfigFunc: func() (*rest.Config, error) {
			panic("mock out the GetConfig method")
		},
	}

	// use mockedProvider in code that requires config.Provider
	// and then make assertions.

}

func (*MockProvider) GetConfig

func (mock *MockProvider) GetConfig() (*rest.Config, error)

GetConfig calls GetConfigFunc.

func (*MockProvider) GetConfigCalls

func (mock *MockProvider) GetConfigCalls() []struct {
}

GetConfigCalls gets all the calls that were made to GetConfig. Check the length with:

len(mockedProvider.GetConfigCalls())

type MockWebhookManager

type MockWebhookManager struct {
	// SetupWebhookServerFunc mocks the SetupWebhookServer method.
	SetupWebhookServerFunc func(mgr manager.Manager)
	// contains filtered or unexported fields
}

MockWebhookManager is a mock implementation of manager.Provider.

func TestSomethingThatUsesProvider(t *testing.T) {

	// make and configure a mocked manager.Provider
	mockedProvider := &MockWebhookManager{
		SetupWebhookServerFunc: func(mgr manager.Manager)  {
			panic("mock out the SetupWebhookServer method")
		},
	}

	// use mockedProvider in code that requires manager.Provider
	// and then make assertions.

}

func (*MockWebhookManager) SetupWebhookServer

func (mock *MockWebhookManager) SetupWebhookServer(mgr manager.Manager)

SetupWebhookServer calls SetupWebhookServerFunc.

func (*MockWebhookManager) SetupWebhookServerCalls

func (mock *MockWebhookManager) SetupWebhookServerCalls() []struct {
	Mgr manager.Manager
}

SetupWebhookServerCalls gets all the calls that were made to SetupWebhookServer. Check the length with:

len(mockedProvider.SetupWebhookServerCalls())

Jump to

Keyboard shortcuts

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