testutil

package
v0.9.3-beta.13 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultStorageProvisoner = "kubernetes.io/no-provisioner"
	DefaultCSIDriver         = "hostpath.csi.k8s.io"
)

Variables

This section is empty.

Functions

func SetKubeServerVersion

func SetKubeServerVersion(major, minor, patch string)

SetKubeServerVersion provides "_KUBE_SERVER_INFO" viper settings helper function.

func SetKubeServerVersionWithDistro

func SetKubeServerVersionWithDistro(major, minor, patch, distro string)

SetKubeServerVersionWithDistro provides "_KUBE_SERVER_INFO" viper settings helper function.

Types

type TestContext

type TestContext struct {
	Ctx                                context.Context
	Cli                                client.Client
	TestEnv                            *envtest.Environment
	TestObjLabelKey                    string
	DefaultNamespace                   string
	DefaultEventuallyTimeout           time.Duration
	DefaultEventuallyPollingInterval   time.Duration
	DefaultConsistentlyDuration        time.Duration
	DefaultConsistentlyPollingInterval time.Duration
	ClearResourceTimeout               time.Duration
	ClearResourcePollingInterval       time.Duration
	CreateObj                          func(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
	CheckedCreateObj                   func(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
}

func NewDefaultTestContext

func NewDefaultTestContext(ctx context.Context, cli client.Client, testEnv *envtest.Environment, namespace ...string) TestContext

NewDefaultTestContext creates default test context, if provided namespace optional arg, a namespace will be created if not exist

func (TestContext) Create

func (testCtx TestContext) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error

func (TestContext) CreateNamespace

func (testCtx TestContext) CreateNamespace() error

func (TestContext) GetNamespaceKey

func (testCtx TestContext) GetNamespaceKey() client.ObjectKey

func (TestContext) GetNamespaceObj

func (testCtx TestContext) GetNamespaceObj() corev1.Namespace

func (TestContext) GetRandomStr

func (testCtx TestContext) GetRandomStr() string

func (TestContext) GetWebhookHostExternalName

func (testCtx TestContext) GetWebhookHostExternalName() string

func (TestContext) UseDefaultNamespace

func (testCtx TestContext) UseDefaultNamespace() func(client.Object)

func (TestContext) UsingExistingCluster

func (testCtx TestContext) UsingExistingCluster() bool

Directories

Path Synopsis
k8s

Jump to

Keyboard shortcuts

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