framework

package
v0.0.0-...-8aabc32 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Failf

func Failf(format string, args ...interface{})

Failf fails the test with the given message.

func FailfWithOffset

func FailfWithOffset(offset int, format string, args ...interface{})

FailfWithOffset fails the test with the given message.

The offset argument is used to modify the call-stack offset when computing line numbers. This is useful in helper functions that make assertions so that error messages refer to the calling line in the test, as opposed to the line in the helper function.

e.g. "It(...) -> f -> FailfWithOffset(1, ...)" will be logged for "It"

func Logf

func Logf(format string, args ...interface{})

Logf logs the given message.

func RandomSuffix

func RandomSuffix() string

RandomSuffix provides a random sequence that can be appended to API objects' names.

func WaitForDefaultServiceAccountInNamespace

func WaitForDefaultServiceAccountInNamespace(c clientset.Interface, namespace string) error

WaitForDefaultServiceAccountInNamespace waits for the default ServiceAccount to be provisioned in the given namespace.

Types

type Framework

type Framework struct {
	UniqueName string // e.g. "mytest-1234"

	KubeClient    clientset.Interface
	DynamicClient dynamic.Interface
	// contains filtered or unexported fields
}

Framework wraps the context and common operations for tests.

func New

func New(baseName string) *Framework

New creates a test Framework.

func (*Framework) AddNamespacesToDelete

func (f *Framework) AddNamespacesToDelete(namespaces ...*corev1.Namespace)

AddNamespacesToDelete marks one or more namespaces for deletion when the test completes.

func (*Framework) AfterEach

func (f *Framework) AfterEach()

AfterEach performs common cleanup tasks.

func (*Framework) BeforeEach

func (f *Framework) BeforeEach()

BeforeEach performs common initialization tasks.

func (*Framework) ClientConfig

func (f *Framework) ClientConfig() *rest.Config

ClientConfig returns a copy of the Framework's rest.Config. Can be used to generate new API clients.

func (*Framework) CreateNamespace

func (f *Framework) CreateNamespace(baseName string, l ...labels.Set) (*corev1.Namespace, error)

CreateNamespace creates a namespace and marks it for automatic cleanup at the end of the test.

type TestConfig

type TestConfig struct {
	// Path to a Kubeconfig file containing credentials to interact with Kubernetes.
	Kubeconfig string
}

TestConfig contains the configuration of a test context.

var Config TestConfig

Config holds the global configuration of the current test context.

Directories

Path Synopsis
Package apps contains helpers to interact with various Kubernetes workloads.
Package apps contains helpers to interact with various Kubernetes workloads.
aws
Package aws contains helpers to interact with AWS services.
Package aws contains helpers to interact with AWS services.
eventbridge
Package eventbridge contains helpers for AWS EventBridge.
Package eventbridge contains helpers for AWS EventBridge.
iam
Package iam contains helpers to interact with IAM objects.
Package iam contains helpers to interact with IAM objects.
sqs
Package sqs contains helpers for AWS SQS.
Package sqs contains helpers for AWS SQS.
Package bridges contains helpers to interact with Bridge objects.
Package bridges contains helpers to interact with Bridge objects.
Package cloudevents contains helpers to interact with CloudEvents.
Package cloudevents contains helpers to interact with CloudEvents.
Package ducktypes contains helpers to interact with Knative duck-typed objects.
Package ducktypes contains helpers to interact with Knative duck-typed objects.
Package manifest contains helpers to consume objects from Kubernetes manifests.
Package manifest contains helpers to consume objects from Kubernetes manifests.

Jump to

Keyboard shortcuts

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