test

package
v0.4.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExampleCRD = &apiextensionsv1beta1.CustomResourceDefinition{
	TypeMeta: metav1.TypeMeta{
		APIVersion: "apiextensions.k8s.io/v1beta1",
		Kind:       "CustomResourceDefinition",
	},
	ObjectMeta: metav1.ObjectMeta{
		Name: "foos.example.com",
	},
	Spec: apiextensionsv1beta1.CustomResourceDefinitionSpec{
		Group: "example.com",
		Names: apiextensionsv1beta1.CustomResourceDefinitionNames{
			Kind:   "Foo",
			Plural: "foos",
		},
		Scope:   apiextensionsv1beta1.NamespaceScoped,
		Version: "v1",
	},
}

ExampleCRD is an example CRD object for use within test suites

View Source
var ExampleDeployment = &appsv1.Deployment{
	TypeMeta: metav1.TypeMeta{
		APIVersion: "apps/v1",
		Kind:       "Deployment",
	},
	ObjectMeta: metav1.ObjectMeta{
		Name:      "example",
		Namespace: "default",
		Labels:    appNginx,
	},
	Spec: appsv1.DeploymentSpec{
		Selector: &metav1.LabelSelector{
			MatchLabels: appNginx,
		},
		Template: corev1.PodTemplateSpec{
			ObjectMeta: metav1.ObjectMeta{
				Labels: appNginx,
			},
			Spec: corev1.PodSpec{
				Containers: []corev1.Container{
					{
						Name:  "nginx",
						Image: "nginx",
					},
				},
			},
		},
	},
}

ExampleDeployment is an example Deployment object for use within test suites

View Source
var ExampleFoo = &unstructured.Unstructured{
	Object: map[string]interface{}{
		"apiVersion": "example.com/v1",
		"kind":       "Foo",
		"metadata": map[string]interface{}{
			"name":      "example",
			"namespace": "default",
		},
		"spec": map[string]interface{}{
			"foo": "bar",
		},
	},
}

ExampleFoo is an example Foo object for use within test suites

Functions

func DeleteAll

func DeleteAll(cfg *rest.Config, timeout time.Duration, objLists ...runtime.Object)

DeleteAll lists and deletes all resources

func WithAPIVersion

func WithAPIVersion(matcher gtypes.GomegaMatcher) gtypes.GomegaMatcher

WithAPIVersion returns the objects TypeMeta

func WithContainers

func WithContainers(matcher gtypes.GomegaMatcher) gtypes.GomegaMatcher

WithContainers returns the deployments Containers

func WithCreationTimestamp

func WithCreationTimestamp(matcher gtypes.GomegaMatcher) gtypes.GomegaMatcher

WithCreationTimestamp returns the object's CreationTimestamp

func WithImage

func WithImage(matcher gtypes.GomegaMatcher) gtypes.GomegaMatcher

WithImage returns the container's image

func WithKind

func WithKind(matcher gtypes.GomegaMatcher) gtypes.GomegaMatcher

WithKind returns the objects TypeMeta

func WithResourceVersion

func WithResourceVersion(matcher gtypes.GomegaMatcher) gtypes.GomegaMatcher

WithResourceVersion returns the object's ResourceVersion

func WithSelfLink(matcher gtypes.GomegaMatcher) gtypes.GomegaMatcher

WithSelfLink returns the object's SelfLink

func WithUID

func WithUID(matcher gtypes.GomegaMatcher) gtypes.GomegaMatcher

WithUID returns the object's UID

Types

type Matcher

type Matcher struct {
	Client client.Client
}

Matcher has Gomega Matchers that use the controller-runtime client

func (*Matcher) Create

func (m *Matcher) Create(obj Object, extras ...interface{}) gomega.GomegaAssertion

Create creates the object on the API server

func (*Matcher) Get

func (m *Matcher) Get(obj Object, intervals ...interface{}) gomega.GomegaAsyncAssertion

Get gets the object from the API server

type Object

type Object interface {
	runtime.Object
	metav1.Object
	schema.ObjectKind
}

Object is the combination of two interfaces as a helper for passing Kubernetes objects between methods

Jump to

Keyboard shortcuts

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