Help us shape the future of Go! Take the 2026 Go Developer Survey

testutils

package
v1.20.4 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FakeClientBuilderCell = func() cell.Cell {
	return cell.Group(
		cell.ProvidePrivate(newStateDBObjectTracker),
		cell.Provide(FakeClientBuilder),
	)
}

See a comment for FakeClientCell

View Source
var FakeClientCell = func() cell.Cell {
	return cell.Module(
		"k8s-fake-client",
		"Fake Kubernetes client",

		cell.ProvidePrivate(
			newStateDBObjectTracker,
		),

		cell.Provide(
			NewFakeClientsetWithTracker,
			func(fc *FakeClientset) hive.ScriptCmdsOut {
				return hive.NewScriptCmds(FakeClientCommands(fc))
			},
		),
	)
}

We do not create a cell as global variable since compiler will compile all of the fake protobufs into the release binary which increases the binary size by ~20 MB

Functions

func FakeClientBuilder

func FakeClientBuilder(log *slog.Logger, ot *statedbObjectTracker) k8sclient.ClientBuilderFunc

func FakeClientCommands

func FakeClientCommands(fc *FakeClientset) map[string]script.Cmd

Types

type APIExtFakeClientset

type APIExtFakeClientset = apiext_fake.Clientset

type CiliumFakeClientset

type CiliumFakeClientset = cilium_fake.Clientset

type FakeClientset

type FakeClientset struct {
	*MCSAPIFakeClientset
	*KubernetesFakeClientset
	*CiliumFakeClientset
	*APIExtFakeClientset
	*PolicyFakeClientset
	k8sclient.ClientsetGetters

	SlimFakeClientset *SlimFakeClientset
	// contains filtered or unexported fields
}

func NewFakeClientset

func NewFakeClientset(log *slog.Logger) (*FakeClientset, k8sclient.Clientset)

func NewFakeClientsetWithTracker

func NewFakeClientsetWithTracker(log *slog.Logger, ot *statedbObjectTracker) (*FakeClientset, k8sclient.Clientset)

func NewFakeClientsetWithVersion

func NewFakeClientsetWithVersion(log *slog.Logger, ot *statedbObjectTracker, version string) (*FakeClientset, k8sclient.Clientset)

func (*FakeClientset) Config

func (c *FakeClientset) Config() k8sclient.Config

func (*FakeClientset) Disable

func (c *FakeClientset) Disable()

func (*FakeClientset) Discovery

func (*FakeClientset) IsEnabled

func (c *FakeClientset) IsEnabled() bool

func (*FakeClientset) RestConfig

func (c *FakeClientset) RestConfig() *rest.Config

func (*FakeClientset) Slim

type KubernetesFakeClientset

type KubernetesFakeClientset = fake.Clientset

type MCSAPIFakeClientset

type MCSAPIFakeClientset = mcsapi_fake.Clientset

type PolicyFakeClientset added in v1.20.0

type PolicyFakeClientset = policy_fake.Clientset

type SlimFakeClientset

type SlimFakeClientset = slim_fake.Clientset

Jump to

Keyboard shortcuts

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