testutil

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	List = iota
	Create
	Update
	Patch
)

Variables

This section is empty.

Functions

func CreateKindClusterWithVersion

func CreateKindClusterWithVersion(clusterName, configPath string) env.Func

CreateKindClusterWithVersion create KinD cluster with a specific version

func CreateNSForTest

func CreateNSForTest(ctx context.Context, cfg *envconf.Config, t *testing.T, runID string) (context.Context, error)

TODO: rename me in CreateNamespace CreateNSForTest creates a random namespace with the runID as a prefix. It is stored in the context so that the deleteNSForTest routine can look it up and delete it.

func CreateNamespace

func CreateNamespace(ctx context.Context, k8sClient client.Client, name string) error

func DeleteNamespace

func DeleteNamespace(ctx context.Context, cfg *envconf.Config, t *testing.T, _ string) (context.Context, error)

DeleteNamespace looks up the namespace corresponding to the given test and deletes it.

func DestroyKindCluster

func DestroyKindCluster(clusterName string) env.Func

CreateKindClusterWithVersion destroy KinD cluster with cluster name. If skipDeleteClusterFlag is set, it avoid the delete of the cluster (useful when running tests locally various times).

func GetClusterVersion

func GetClusterVersion() env.Func

func GetResource

func GetResource(ctx context.Context, k8sClient client.Client, name, namespace string, resource *unstructured.Unstructured) error

func RandString

func RandString(n int) string

func SetupCRDs

func SetupCRDs(crdPath, pattern string) env.Func

func SetupEnvTest added in v0.5.1

func SetupEnvTest() env.Func

func StopEnvTest added in v0.5.1

func StopEnvTest() env.Func

Types

type Method

type Method int

type PossiblyErroringFakeCtrlRuntimeClient

type PossiblyErroringFakeCtrlRuntimeClient struct {
	client.Client
	ShouldError func(method Method, obj runtime.Object) bool
}

func (PossiblyErroringFakeCtrlRuntimeClient) Create

func (PossiblyErroringFakeCtrlRuntimeClient) List

func (PossiblyErroringFakeCtrlRuntimeClient) Patch

func (PossiblyErroringFakeCtrlRuntimeClient) Update

Jump to

Keyboard shortcuts

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