testtypes

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package testtypes implements types we can use in all of our unit tests.

Index

Constants

This section is empty.

Variables

View Source
var (
	// BootstrapGroupVersion is group version used for bootstrap objects.
	BootstrapGroupVersion = schema.GroupVersion{Group: "bootstrap.cluster.x-k8s.io", Version: "v1alpha4"}

	// GenericBootstrapConfigKind is the Kind for the GenericBootstrapConfig.
	GenericBootstrapConfigKind = "GenericBootstrapConfig"
	// GenericBootstrapConfigCRD is a generic boostrap CRD.
	GenericBootstrapConfigCRD = generateCRD(BootstrapGroupVersion.WithKind(GenericBootstrapConfigKind))

	// GenericBootstrapConfigTemplateKind is the Kind for the GenericBoostrapConfigTemplate.
	GenericBootstrapConfigTemplateKind = "GenericBootstrapConfigTemplate"
	// GenericBootstrapConfigTemplateCRD is a generic boostrap template CRD.
	GenericBootstrapConfigTemplateCRD = generateCRD(BootstrapGroupVersion.WithKind(GenericBootstrapConfigTemplateKind))
)
View Source
var (
	// ControlPlaneGroupVersion is group version used for control plane objects.
	ControlPlaneGroupVersion = schema.GroupVersion{Group: "controlplane.cluster.x-k8s.io", Version: "v1alpha4"}

	// GenericControlPlaneKind is the Kind for the GenericControlPlane.
	GenericControlPlaneKind = "GenericControlPlane"
	// GenericControlPlaneCRD is a generic control plane CRD.
	GenericControlPlaneCRD = generateCRD(ControlPlaneGroupVersion.WithKind(GenericControlPlaneKind))

	// GenericControlPlaneTemplateKind is the Kind for the GenericControlPlaneTemplate.
	GenericControlPlaneTemplateKind = "GenericControlPlaneTemplate"
	// GenericControlPlaneTemplateCRD is a generic control plane template CRD.
	GenericControlPlaneTemplateCRD = generateCRD(ControlPlaneGroupVersion.WithKind(GenericControlPlaneTemplateKind))
)
View Source
var (
	// InfrastructureGroupVersion is group version used for infrastructure objects.
	InfrastructureGroupVersion = schema.GroupVersion{Group: "infrastructure.cluster.x-k8s.io", Version: "v1alpha4"}

	// GenericInfrastructureMachineKind is the Kind for the GenericInfrastructureMachine.
	GenericInfrastructureMachineKind = "GenericInfrastructureMachine"
	// GenericInfrastructureMachineCRD is a generic infrastructure machine CRD.
	GenericInfrastructureMachineCRD = generateCRD(InfrastructureGroupVersion.WithKind(GenericInfrastructureMachineKind))

	// GenericInfrastructureMachineTemplateKind is the Kind for the GenericInfrastructureMachineTemplate.
	GenericInfrastructureMachineTemplateKind = "GenericInfrastructureMachineTemplate"
	// GenericInfrastructureMachineTemplateCRD is a generic infrastructure machine template CRD.
	GenericInfrastructureMachineTemplateCRD = generateCRD(InfrastructureGroupVersion.WithKind(GenericInfrastructureMachineTemplateKind))

	// GenericInfrastructureClusterKind is the kind for the GenericInfrastructureCluster type.
	GenericInfrastructureClusterKind = "GenericInfrastructureCluster"
	// GenericInfrastructureClusterCRD is a generic infrastructure machine CRD.
	GenericInfrastructureClusterCRD = generateCRD(InfrastructureGroupVersion.WithKind(GenericInfrastructureClusterKind))

	// GenericInfrastructureClusterTemplateKind is the kind for the GenericInfrastructureClusterTemplate type.
	GenericInfrastructureClusterTemplateKind = "GenericInfrastructureClusterTemplate"
	// GenericInfrastructureClusterTemplateCRD is a generic infrastructure machine template CRD.
	GenericInfrastructureClusterTemplateCRD = generateCRD(InfrastructureGroupVersion.WithKind(GenericInfrastructureClusterTemplateKind))
)
View Source
var (
	// RemediationGroupVersion is group version used for remediation objects.
	RemediationGroupVersion = schema.GroupVersion{Group: "remediation.external.io", Version: "v1alpha4"}

	// GenericRemediationCRD is a generic infrastructure remediation CRD.
	GenericRemediationCRD = generateCRD(RemediationGroupVersion.WithKind("GenericExternalRemediation"))

	// GenericRemediationTemplateCRD is a generic infrastructure remediation template CRD.
	GenericRemediationTemplateCRD = generateCRD(RemediationGroupVersion.WithKind("GenericExternalRemediationTemplate"))
)

Functions

This section is empty.

Types

type BootstrapTemplateBuilder added in v0.4.3

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

BootstrapTemplateBuilder holds the variables needed to build a generic BootstrapTemplate.

func NewBootstrapTemplateBuilder added in v0.4.3

func NewBootstrapTemplateBuilder(namespace, name string) *BootstrapTemplateBuilder

NewBootstrapTemplateBuilder creates a BootstrapTemplateBuilder with the given name and namespace.

func (*BootstrapTemplateBuilder) Build added in v0.4.3

Build creates a new Unstructured object with the information passed to the BootstrapTemplateBuilder.

type ClusterBuilder added in v0.4.3

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

ClusterBuilder holds the variables and objects required to build a clusterv1.Cluster.

func NewClusterBuilder added in v0.4.3

func NewClusterBuilder(namespace, name string) *ClusterBuilder

NewClusterBuilder returns a ClusterBuilder with the given name and namespace.

func (*ClusterBuilder) Build added in v0.4.3

func (c *ClusterBuilder) Build() *clusterv1.Cluster

Build returns a Cluster with the attributes added to the ClusterBuilder.

func (*ClusterBuilder) WithClusterClass added in v0.4.3

func (c *ClusterBuilder) WithClusterClass(class clusterv1.ClusterClass) *ClusterBuilder

WithClusterClass adds the passed ClusterClass Name to the ClusterBuilder.

func (*ClusterBuilder) WithControlPlane added in v0.4.3

func (c *ClusterBuilder) WithControlPlane(t *unstructured.Unstructured) *ClusterBuilder

WithControlPlane adds the passed ControlPlane to the ClusterBuilder.

func (*ClusterBuilder) WithInfrastructureCluster added in v0.4.3

func (c *ClusterBuilder) WithInfrastructureCluster(t *unstructured.Unstructured) *ClusterBuilder

WithInfrastructureCluster adds the passed InfrastructureCluster to the ClusterBuilder.

type ClusterClassBuilder added in v0.4.3

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

ClusterClassBuilder holds the variables and objects required to build a clusterv1.ClusterClass.

func NewClusterClassBuilder added in v0.4.3

func NewClusterClassBuilder(namespace, name string) *ClusterClassBuilder

NewClusterClassBuilder returns a ClusterClassBuilder with the given name and namespace.

func (*ClusterClassBuilder) Build added in v0.4.3

Build takes the objects and variables in the ClusterClass builder and uses them to create a ClusterClass object.

func (*ClusterClassBuilder) WithControlPlaneInfrastructureMachineTemplate added in v0.4.3

func (c *ClusterClassBuilder) WithControlPlaneInfrastructureMachineTemplate(t *unstructured.Unstructured) *ClusterClassBuilder

WithControlPlaneInfrastructureMachineTemplate adds the ControlPlane's InfrastructureMachineTemplate to the ClusterClassBuilder.

func (*ClusterClassBuilder) WithControlPlaneMetadata added in v0.4.3

func (c *ClusterClassBuilder) WithControlPlaneMetadata(labels, annotations map[string]string) *ClusterClassBuilder

WithControlPlaneMetadata adds the given labels and annotations for use with the ControlPlane to the ClusterClassBuilder.

func (*ClusterClassBuilder) WithControlPlaneTemplate added in v0.4.3

func (c *ClusterClassBuilder) WithControlPlaneTemplate(t *unstructured.Unstructured) *ClusterClassBuilder

WithControlPlaneTemplate adds the passed ControlPlaneTemplate to the ClusterClassBuilder.

func (*ClusterClassBuilder) WithInfrastructureClusterTemplate added in v0.4.3

func (c *ClusterClassBuilder) WithInfrastructureClusterTemplate(t *unstructured.Unstructured) *ClusterClassBuilder

WithInfrastructureClusterTemplate adds the passed InfrastructureClusterTemplate to the ClusterClassBuilder.

func (*ClusterClassBuilder) WithWorkerMachineDeploymentClasses added in v0.4.3

func (c *ClusterClassBuilder) WithWorkerMachineDeploymentClasses(mdcs []clusterv1.MachineDeploymentClass) *ClusterClassBuilder

WithWorkerMachineDeploymentClasses adds the variables and objects needed to create MachineDeploymentTemplates for a ClusterClassBuilder.

type ControlPlaneBuilder added in v0.4.3

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

ControlPlaneBuilder holds the variables and objects needed to build a generic object for cluster.spec.controlPlaneRef.

func NewControlPlaneBuilder added in v0.4.3

func NewControlPlaneBuilder(namespace, name string) *ControlPlaneBuilder

NewControlPlaneBuilder returns a ControlPlaneBuilder with the given name and Namespace.

func (*ControlPlaneBuilder) Build added in v0.4.3

Build generates an Unstructured object from the information passed to the ControlPlaneBuilder.

func (*ControlPlaneBuilder) WithInfrastructureMachineTemplate added in v0.4.3

func (f *ControlPlaneBuilder) WithInfrastructureMachineTemplate(t *unstructured.Unstructured) *ControlPlaneBuilder

WithInfrastructureMachineTemplate adds the given unstructured object to the ControlPlaneBuilder as its InfrastructureMachineTemplate.

func (*ControlPlaneBuilder) WithSpecFields added in v0.4.3

func (f *ControlPlaneBuilder) WithSpecFields(m map[string]interface{}) *ControlPlaneBuilder

WithSpecFields sets a map of spec fields on the unstructured object. The keys in the map represent the path and the value corresponds to the value of the spec field.

Note: all the paths should start with "spec."

Example map: map[string]interface{}{
    "spec.version": "v1.2.3",
}.

func (*ControlPlaneBuilder) WithStatusFields added in v0.4.3

func (f *ControlPlaneBuilder) WithStatusFields(m map[string]interface{}) *ControlPlaneBuilder

WithStatusFields sets a map of status fields on the unstructured object. The keys in the map represent the path and the value corresponds to the value of the status field.

Note: all the paths should start with "status."

Example map: map[string]interface{}{
    "status.version": "v1.2.3",
}.

type ControlPlaneTemplateBuilder added in v0.4.3

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

ControlPlaneTemplateBuilder holds the variables and objects needed to build a generic ControlPlane template.

func NewControlPlaneTemplateBuilder added in v0.4.3

func NewControlPlaneTemplateBuilder(namespace, name string) *ControlPlaneTemplateBuilder

NewControlPlaneTemplateBuilder creates a NewControlPlaneTemplate builder with the given name and namespace.

func (*ControlPlaneTemplateBuilder) Build added in v0.4.3

Build creates an Unstructured object from the variables passed to the ControlPlaneTemplateBuilder.

func (*ControlPlaneTemplateBuilder) WithInfrastructureMachineTemplate added in v0.4.3

func (c *ControlPlaneTemplateBuilder) WithInfrastructureMachineTemplate(t *unstructured.Unstructured) *ControlPlaneTemplateBuilder

WithInfrastructureMachineTemplate adds the given Unstructured object to the ControlPlaneTemplateBuilder as its InfrastructureMachineTemplate.

func (*ControlPlaneTemplateBuilder) WithSpecFields added in v0.4.3

func (c *ControlPlaneTemplateBuilder) WithSpecFields(fields map[string]interface{}) *ControlPlaneTemplateBuilder

WithSpecFields will add fields of any type to the object spec. It takes an argument, fields, which is of the form path: object.

type InfrastructureClusterBuilder added in v0.4.3

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

InfrastructureClusterBuilder holds the variables and objects needed to build a generic InfrastructureCluster.

func NewInfrastructureClusterBuilder added in v0.4.3

func NewInfrastructureClusterBuilder(namespace, name string) *InfrastructureClusterBuilder

NewInfrastructureClusterBuilder returns and InfrastructureClusterBuilder with the given name and namespace.

func (*InfrastructureClusterBuilder) Build added in v0.4.3

Build returns an Unstructured object with the information passed to the InfrastructureClusterBuilder.

func (*InfrastructureClusterBuilder) WithSpecFields added in v0.4.3

func (i *InfrastructureClusterBuilder) WithSpecFields(fields map[string]interface{}) *InfrastructureClusterBuilder

WithSpecFields will add fields of any type to the object spec. It takes an argument, fields, which is of the form path: object.

type InfrastructureClusterTemplateBuilder added in v0.4.3

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

InfrastructureClusterTemplateBuilder holds the variables needed to build a generic InfrastructureClusterTemplate.

func NewInfrastructureClusterTemplateBuilder added in v0.4.3

func NewInfrastructureClusterTemplateBuilder(namespace, name string) *InfrastructureClusterTemplateBuilder

NewInfrastructureClusterTemplateBuilder returns an InfrastructureClusterTemplateBuilder with the given name and namespace.

func (*InfrastructureClusterTemplateBuilder) Build added in v0.4.3

Build creates a new Unstructured object with the variables passed to the InfrastructureClusterTemplateBuilder.

func (*InfrastructureClusterTemplateBuilder) WithSpecFields added in v0.4.3

func (i *InfrastructureClusterTemplateBuilder) WithSpecFields(fields map[string]interface{}) *InfrastructureClusterTemplateBuilder

WithSpecFields will add fields of any type to the object spec. It takes an argument, fields, which is of the form path: object.

type InfrastructureMachineTemplateBuilder added in v0.4.3

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

InfrastructureMachineTemplateBuilder holds the variables and objects needed to build an InfrastructureMachineTemplate.

func NewInfrastructureMachineTemplateBuilder added in v0.4.3

func NewInfrastructureMachineTemplateBuilder(namespace, name string) *InfrastructureMachineTemplateBuilder

NewInfrastructureMachineTemplateBuilder creates an InfrastructureMachineTemplateBuilder with the given name and namespace.

func (*InfrastructureMachineTemplateBuilder) Build added in v0.4.3

Build takes the objects and variables in the InfrastructureMachineTemplateBuilder and generates an unstructured object.

func (*InfrastructureMachineTemplateBuilder) WithSpecFields added in v0.4.3

func (i *InfrastructureMachineTemplateBuilder) WithSpecFields(fields map[string]interface{}) *InfrastructureMachineTemplateBuilder

WithSpecFields will add fields of any type to the object spec. It takes an argument, fields, which is of the form path: object.

type MachineDeploymentBuilder added in v0.4.3

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

MachineDeploymentBuilder holds the variables and objects needed to build a generic MachineDeployment.

func NewMachineDeploymentBuilder added in v0.4.3

func NewMachineDeploymentBuilder(namespace, name string) *MachineDeploymentBuilder

NewMachineDeploymentBuilder creates a MachineDeploymentBuilder with the given name and namespace.

func (*MachineDeploymentBuilder) Build added in v0.4.3

Build creates a new MachineDeployment with the variables and objects passed to the MachineDeploymentBuilder.

func (*MachineDeploymentBuilder) WithBootstrapTemplate added in v0.4.3

WithBootstrapTemplate adds the passed Unstructured object to the MachineDeploymentBuilder as a bootstrapTemplate.

func (*MachineDeploymentBuilder) WithGeneration added in v0.4.3

func (m *MachineDeploymentBuilder) WithGeneration(generation int64) *MachineDeploymentBuilder

WithGeneration sets the passed value on the machine deployments object metadata.

func (*MachineDeploymentBuilder) WithInfrastructureTemplate added in v0.4.3

func (m *MachineDeploymentBuilder) WithInfrastructureTemplate(ref *unstructured.Unstructured) *MachineDeploymentBuilder

WithInfrastructureTemplate adds the passed unstructured object to the MachineDeployment builder as an infrastructureMachineTemplate.

func (*MachineDeploymentBuilder) WithLabels added in v0.4.3

WithLabels adds the given labels to the MachineDeploymentBuilder.

func (*MachineDeploymentBuilder) WithReplicas added in v0.4.3

func (m *MachineDeploymentBuilder) WithReplicas(replicas int32) *MachineDeploymentBuilder

WithReplicas sets the number of replicas for the MachineDeploymentClassBuilder.

func (*MachineDeploymentBuilder) WithStatus added in v0.4.3

WithStatus sets the passed status object as the status of the machine deployment object. TODO (killianmuldoon): Revise making this method consistent with WithSpec fields in objectbuilders.

func (*MachineDeploymentBuilder) WithVersion added in v0.4.3

func (m *MachineDeploymentBuilder) WithVersion(version string) *MachineDeploymentBuilder

WithVersion sets the passed version on the machine deployment spec.

type MachineDeploymentClassBuilder added in v0.4.3

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

MachineDeploymentClassBuilder holds the variables and objects required to build a clusterv1.MachineDeploymentClass.

func NewMachineDeploymentClassBuilder added in v0.4.3

func NewMachineDeploymentClassBuilder(namespace, name string) *MachineDeploymentClassBuilder

NewMachineDeploymentClassBuilder returns a MachineDeploymentClassBuilder with the given name and namespace.

func (*MachineDeploymentClassBuilder) Build added in v0.4.3

Build creates a full MachineDeploymentClass object with the variables passed to the MachineDeploymentClassBuilder.

func (*MachineDeploymentClassBuilder) WithAnnotations added in v0.4.3

func (m *MachineDeploymentClassBuilder) WithAnnotations(annotations map[string]string) *MachineDeploymentClassBuilder

WithAnnotations sets the annotations for the MachineDeploymentClassBuilder.

func (*MachineDeploymentClassBuilder) WithBootstrapTemplate added in v0.4.3

WithBootstrapTemplate registers the passed Unstructured object as the BootstrapTemplate for the MachineDeploymentClassBuilder.

func (*MachineDeploymentClassBuilder) WithClass added in v0.4.3

WithClass sets the MachineDeploymentClass name for the MachineDeploymentClassBuilder.

func (*MachineDeploymentClassBuilder) WithInfrastructureTemplate added in v0.4.3

WithInfrastructureTemplate registers the passed Unstructured object as the InfrastructureMachineTemplate for the MachineDeploymentClassBuilder.

func (*MachineDeploymentClassBuilder) WithLabels added in v0.4.3

WithLabels sets the labels for the MachineDeploymentClassBuilder.

type MachineSetBuilder added in v0.4.3

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

MachineSetBuilder holds the variables and objects needed to build a generic MachineSet.

func NewMachineSetBuilder added in v0.4.3

func NewMachineSetBuilder(namespace, name string) *MachineSetBuilder

NewMachineSetBuilder creates a MachineSetBuilder with the given name and namespace.

func (*MachineSetBuilder) Build added in v0.4.3

Build creates a new MachineSet with the variables and objects passed to the MachineSetBuilder.

func (*MachineSetBuilder) WithBootstrapTemplate added in v0.4.3

func (m *MachineSetBuilder) WithBootstrapTemplate(ref *unstructured.Unstructured) *MachineSetBuilder

WithBootstrapTemplate adds the passed Unstructured object to the MachineSetBuilder as a bootstrapTemplate.

func (*MachineSetBuilder) WithInfrastructureTemplate added in v0.4.3

func (m *MachineSetBuilder) WithInfrastructureTemplate(ref *unstructured.Unstructured) *MachineSetBuilder

WithInfrastructureTemplate adds the passed unstructured object to the MachineSet builder as an infrastructureMachineTemplate.

func (*MachineSetBuilder) WithLabels added in v0.4.3

func (m *MachineSetBuilder) WithLabels(labels map[string]string) *MachineSetBuilder

WithLabels adds the given labels to the MachineSetBuilder.

func (*MachineSetBuilder) WithReplicas added in v0.4.3

func (m *MachineSetBuilder) WithReplicas(replicas *int32) *MachineSetBuilder

WithReplicas sets the number of replicas for the MachineSetClassBuilder.

Jump to

Keyboard shortcuts

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