dependency

package
v1.65.6 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithExternalDependencies

func WithExternalDependencies(f func(input *go_hook.HookInput, dc Container) error) func(input *go_hook.HookInput) error

WithExternalDependencies decorate function with external dependencies

Types

type Container

type Container interface {
	GetHTTPClient(options ...http.Option) http.Client
	GetEtcdClient(endpoints []string, options ...etcd.Option) (etcd.Client, error)
	MustGetEtcdClient(endpoints []string, options ...etcd.Option) etcd.Client
	GetK8sClient(options ...k8s.Option) (k8s.Client, error)
	MustGetK8sClient(options ...k8s.Option) k8s.Client
	GetRegistryClient(repo string, options ...cr.Option) (cr.Client, error)
	GetVsphereClient(config *vsphere.ProviderClusterConfiguration) (vsphere.Client, error)
	GetHelmClient(namespace string, options ...helm.Option) (helm.Client, error)
	GetClientConfig() (*rest.Config, error)
	GetClock() clockwork.Clock
}

Container with external dependencies

func NewDependencyContainer

func NewDependencyContainer() Container

NewDependencyContainer creates new Dependency container with external clients

type MockedContainer added in v1.65.0

type MockedContainer struct {
	HelmClient    *helm.ClientMock
	HTTPClient    *http.ClientMock
	EtcdClient    *etcd.ClientMock
	K8sClient     k8s.Client
	CRClient      *cr.ClientMock
	VsphereClient *vsphere.ClientMock
	// contains filtered or unexported fields
}

Mocks

var (
	TestDC       *MockedContainer
	TestTimeZone = time.UTC
)

func NewMockedContainer added in v1.65.0

func NewMockedContainer() *MockedContainer

func (*MockedContainer) GetClientConfig added in v1.65.0

func (c *MockedContainer) GetClientConfig() (*rest.Config, error)

func (*MockedContainer) GetClock added in v1.65.0

func (c *MockedContainer) GetClock() clockwork.Clock

func (*MockedContainer) GetEtcdClient added in v1.65.0

func (c *MockedContainer) GetEtcdClient(_ []string, _ ...etcd.Option) (etcd.Client, error)

func (*MockedContainer) GetFakeClock added in v1.65.0

func (c *MockedContainer) GetFakeClock() clockwork.FakeClock

func (*MockedContainer) GetHTTPClient added in v1.65.0

func (c *MockedContainer) GetHTTPClient(_ ...http.Option) http.Client

func (*MockedContainer) GetHelmClient added in v1.65.0

func (c *MockedContainer) GetHelmClient(_ string, _ ...helm.Option) (helm.Client, error)

func (*MockedContainer) GetK8sClient added in v1.65.0

func (c *MockedContainer) GetK8sClient(_ ...k8s.Option) (k8s.Client, error)

func (*MockedContainer) GetRegistryClient added in v1.65.0

func (c *MockedContainer) GetRegistryClient(_ string, _ ...cr.Option) (cr.Client, error)

func (*MockedContainer) GetVsphereClient added in v1.65.0

func (*MockedContainer) MustGetEtcdClient added in v1.65.0

func (c *MockedContainer) MustGetEtcdClient(_ []string, _ ...etcd.Option) etcd.Client

func (*MockedContainer) MustGetK8sClient added in v1.65.0

func (c *MockedContainer) MustGetK8sClient(options ...k8s.Option) k8s.Client

func (*MockedContainer) SetK8sVersion added in v1.65.0

func (c *MockedContainer) SetK8sVersion(ver k8s.FakeClusterVersion)

SetK8sVersion change FakeCluster versions. KubeClient returns with resources of specified version

Jump to

Keyboard shortcuts

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