controller-runtime: sigs.k8s.io/controller-runtime/pkg/client/fake Index | Files

package fake

import "sigs.k8s.io/controller-runtime/pkg/client/fake"

Package fake provides a fake client for testing.

An fake client is backed by its simple object store indexed by GroupVersionResource. You can create a fake client with optional objects.

client := NewFakeClient(initObjs...) // initObjs is a slice of runtime.Object

You can invoke the methods defined in the Client interface.

When it doubt, it's almost always better not to use this package and instead use envtest.Environment with a real client and API server.

Index

Package Files

client.go doc.go

func NewFakeClient Uses

func NewFakeClient(initObjs ...runtime.Object) client.Client

NewFakeClient creates a new fake client for testing. You can choose to initialize it with a slice of runtime.Object. Deprecated: use NewFakeClientWithScheme. You should always be passing an explicit Scheme.

func NewFakeClientWithScheme Uses

func NewFakeClientWithScheme(clientScheme *runtime.Scheme, initObjs ...runtime.Object) client.Client

NewFakeClientWithScheme creates a new fake client with the given scheme for testing. You can choose to initialize it with a slice of runtime.Object.

Package fake imports 13 packages (graph) and is imported by 7 packages. Updated 2019-09-19. Refresh now. Tools for package owners.