testutils

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultProviderConfigConverter = func(srcObj client.Object, destObj client.Object) {
	srcPC := srcObj.(*v1alpha1.ProviderConfig)
	destPC := destObj.(*v1alpha1.ProviderConfig)
	srcPC.DeepCopyInto(destPC)
}
View Source
var DefaultSecretConverter = func(srcObj client.Object, destObj client.Object) {
	srcSecret := srcObj.(*v1.Secret)
	destSecret := destObj.(*v1.Secret)
	srcSecret.DeepCopyInto(destSecret)
}

Functions

func ContainsError

func ContainsError(wrappedErr error, containedErr error) bool

ContainsError While testing there is no point in mimicking wrapped error hierarchies, but we do want to distinguish check whether an error is part of the stacktrace

func Epoch

func Epoch() time.Time

func ExpiresAt

func ExpiresAt(d time.Duration) func(time.Time) (string, time.Time)

func IssuedAt

func IssuedAt(d time.Duration) func(time.Time) (string, time.Time)

func JwtToken

func JwtToken(ts timeSupplier, m ...JwtModifier) string

func JwtTokenWithIssuer

func JwtTokenWithIssuer(issuer string, ts timeSupplier, m ...JwtModifier) string

func NewDirectory

func NewDirectory(name string, m ...DirectoryModifier) *v1alpha1.Directory

func NewProviderConfig

func NewProviderConfig(name string, cisSecret string, saSecret string) *v1alpha12.ProviderConfig

func NewSecret

func NewSecret(name string, data map[string][]byte) *v1.Secret

func NotBefore

func NotBefore(d time.Duration) func(time.Time) (string, time.Time)

func Now

func Now() time.Time

Types

type DirectoryModifier

type DirectoryModifier func(dirEnvironment *v1alpha1.Directory)

this pattern can be potentially auto generated, its quite useful to write expressive unittests

func WithConditions

func WithConditions(c ...xpv1.Condition) DirectoryModifier

func WithExternalName

func WithExternalName(externalName string) DirectoryModifier

type FakeKubeClientBuilder

type FakeKubeClientBuilder struct {
	// contains filtered or unexported fields
}

FakeKubeClientBuilder simply implementation of a kubeclient mock, can be configured to store and return any resource

func NewFakeKubeClientBuilder

func NewFakeKubeClientBuilder() FakeKubeClientBuilder

func (FakeKubeClientBuilder) AddResource

func (FakeKubeClientBuilder) AddResources

func (FakeKubeClientBuilder) Build

func (FakeKubeClientBuilder) RegisterResourceConverter

func (b FakeKubeClientBuilder) RegisterResourceConverter(resType client.Object, conv ResourceConverter) FakeKubeClientBuilder

RegisterResourceConverter to be able to read resources resource converters needs to be registered for the type the helper already comes with default converters for secret and providerconfig

type JwtModifier

type JwtModifier func(time.Time) (string, time.Time)

type ResourceConverter

type ResourceConverter func(srcObj client.Object, destObj client.Object)

Jump to

Keyboard shortcuts

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