test

package
v1.37.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Add dependencies used by the build but not by the code to this file.

Index

Constants

View Source
const (
	DefaultNonZeroInt64   int64   = 1
	DefaultNonZeroUint64  uint64  = 1
	DefaultNonZeroFloat64 float64 = 1
	DefaultNonZeroString  string  = "not-zero"
	DefaultNonZeroBool    bool    = true
)

Variables

This section is empty.

Functions

func AssertNodesUnchanged added in v1.23.0

func AssertNodesUnchanged(c kubernetes.Interface, nodes ...*v1.Node) error

func CreateNode added in v1.23.0

func CreateNode(c kubernetes.Interface, name string, labels map[string]string, annotations map[string]string) *v1.Node

func CreateWindowsNode added in v1.23.0

func CreateWindowsNode(cs kubernetes.Interface, name string, variant operator.ProductVariant, version string) *v1.Node

func DeleteAllowTigeraTierAndExpectWait added in v1.35.0

func DeleteAllowTigeraTierAndExpectWait(ctx context.Context, c client.Client, r reconcile.Reconciler, mockStatus *status.MockStatus)

DeleteAllowTigeraTierAndExpectWait deletes the tier resource and expects the Reconciler issues a degraded status, waiting for the tier to become available before progressing its status further. Assumes that mockStatus has any required initial status progression expectations set, and that the Reconciler utilizes the mockStatus object. Assumes the tier resource has been created.

func ExpectResourceCreated

func ExpectResourceCreated(c client.Client, obj client.Object)

ExpectResourceCreated asserts that the given object is created, and populates the provided client.Object with the current state of the object in the cluster.

func ExpectResourceDestroyed

func ExpectResourceDestroyed(c client.Client, obj client.Object, timeout time.Duration)

ExpectResourceDestroyed asserts that the given object no longer exists.

func ExpectWaitForTierWatch added in v1.35.0

func ExpectWaitForTierWatch(ctx context.Context, r reconcile.Reconciler, mockStatus *status.MockStatus)

ExpectWaitForTierWatch expects the Reconciler issues a degraded status, waiting for a Tier watch to be established. Assumes that mockStatus has any required initial status progression expectations set, and that the Reconciler utilizes the mockStatus object.

func ExpectWaitForWatch added in v1.35.0

func ExpectWaitForWatch(ctx context.Context, r reconcile.Reconciler, mockStatus *status.MockStatus, message string)

ExpectWaitForWatch expects the Reconciler issues a degraded status, waiting for a watch to be established. Assumes that mockStatus has any required initial status progression expectations set, and that the Reconciler utilizes the mockStatus object.

func GetContainer added in v1.14.0

func GetContainer(containers []v1.Container, name string) *v1.Container

func GetResource

func GetResource(c client.Client, obj client.Object) error

GetResource gets the requested object, populating obj with its contents.

func MakeTestCA added in v1.14.0

func MakeTestCA(signer string) *crypto.CA

func NewNodeListWatch added in v1.23.0

func NewNodeListWatch(cs kubernetes.Interface) nodeListWatch

func NewTyphaListWatch added in v1.23.0

func NewTyphaListWatch(cs kubernetes.Interface) typhaListWatch

func PrettyFormatProxyTestCase added in v1.37.0

func PrettyFormatProxyTestCase(testCase ProxyTestCase) string

func RunOperator

func RunOperator(mgr manager.Manager, ctx context.Context) (doneChan chan struct{})

RunOperator runs the provided operator manager in a separate goroutine so that the test code isn't blocked. The passed in stop channel can be closed in order to stop the execution of the operator. The channel returned will be closed when the mgr stops.

func VerifyCert added in v1.14.0

func VerifyCert(secret *v1.Secret, expectedSANs ...string)

func VerifyCertSANs added in v1.14.0

func VerifyCertSANs(certBytes []byte, expectedSANs ...string)

func VerifyPublicCert added in v1.14.0

func VerifyPublicCert(secret *v1.Secret, pubKey string, expectedSANs ...string)

Types

type NonZeroDefaultOption added in v1.12.0

type NonZeroDefaultOption func(defaulter *nonZeroValueDefaulter)

func WithInterfaceImplementations added in v1.12.0

func WithInterfaceImplementations(ifaceImpls map[string]interface{}) NonZeroDefaultOption

type ObjectTrackerCall added in v1.35.3

type ObjectTrackerCall string
const (
	ObjectTrackerCallGet    ObjectTrackerCall = "get"
	ObjectTrackerCallCreate ObjectTrackerCall = "create"
	ObjectTrackerCallUpdate ObjectTrackerCall = "update"
	ObjectTrackerCallList   ObjectTrackerCall = "list"
	ObjectTrackerCallDelete ObjectTrackerCall = "delete"
	ObjectTrackerCallWatch  ObjectTrackerCall = "watch"
)

type ObjectTrackerWithCalls added in v1.35.3

type ObjectTrackerWithCalls struct {
	testing.ObjectTracker
	// contains filtered or unexported fields
}

ObjectTrackerWithCalls wraps the default implementation of testing.ObjectTracker to track the calls made.

func NewObjectTrackerWithCalls added in v1.35.3

func NewObjectTrackerWithCalls(clientScheme testing.ObjectScheme) ObjectTrackerWithCalls

func (*ObjectTrackerWithCalls) Add added in v1.35.3

func (*ObjectTrackerWithCalls) CallCount added in v1.35.3

func (*ObjectTrackerWithCalls) Create added in v1.35.3

func (*ObjectTrackerWithCalls) Delete added in v1.35.3

func (*ObjectTrackerWithCalls) Get added in v1.35.3

func (*ObjectTrackerWithCalls) List added in v1.35.3

func (*ObjectTrackerWithCalls) Update added in v1.35.3

func (*ObjectTrackerWithCalls) Watch added in v1.35.3

type ProxyConfig added in v1.37.0

type ProxyConfig struct {
	HTTPProxy  string
	HTTPSProxy string
	NoProxy    string
}

type ProxyTestCase added in v1.37.0

type ProxyTestCase struct {
	Lowercase  bool
	Target     string
	PodProxies []*ProxyConfig
}

type ValueDefaulter added in v1.12.0

type ValueDefaulter interface {
	SetDefault(interface{}) error
}

func NewNonZeroStructDefaulter added in v1.12.0

func NewNonZeroStructDefaulter(options ...NonZeroDefaultOption) ValueDefaulter

NewNonZeroStructDefaulter creates an implementation of the ValueDefaulter that

Jump to

Keyboard shortcuts

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