test

package
v0.3.20 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const NextCAPIContractNotSupported = "v99"

NextCAPIContractNotSupported define the next Cluster API contract, not supported by this release of clusterctl.

Variables

View Source
var CurrentCAPIContract = clusterv1.GroupVersion.Version

CurrentCAPIContract define the current Cluster API contract.

View Source
var (
	FakeScheme = runtime.NewScheme()
)
View Source
var PreviousCAPIContractNotSupported = clusterv1old.GroupVersion.Version

PreviousCAPIContractNotSupported define the previous Cluster API contract, not supported by this release of clusterctl.

Functions

func FakeCAPISetupObjects added in v0.3.15

func FakeCAPISetupObjects() []runtime.Object

FakeCAPISetupObjects return required objects in order to make kubeadm pass checks ensuring that management cluster has a proper release of Cluster API installed.

func FakeCRDList

FakeCRDList returns FakeCustomResourceDefinitions for all the Types used in the test object graph

func FakeCustomResourceDefinition

func FakeCustomResourceDefinition(group string, kind string, versions ...string) *apiextensionslv1.CustomResourceDefinition

FakeCustomResourceDefinition returns a fake CRD object for the given group/versions/kind.

func NewFakeGitHub

func NewFakeGitHub() (client *github.Client, mux *http.ServeMux, teardown func())

NewFakeGitHub sets up a test HTTP server along with a github.Client that is configured to talk to that test server. Tests should register handlers on mux which provide mock responses for the API method being tested.

func SelectClusterObj added in v0.3.7

func SelectClusterObj(objs []runtime.Object, namespace, name string) *clusterv1.Cluster

Types

type FakeCluster

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

func NewFakeCluster

func NewFakeCluster(namespace, name string) *FakeCluster

NewFakeCluster return a FakeCluster that can generate a cluster object, all its own ancillary objects: - the clusterInfrastructure object - the kubeconfig secret object (if there is no a control plane object) - a user defined ca secret and all the objects for the defined FakeControlPlane, FakeMachinePools, FakeMachineDeployments, FakeMachineSets, FakeMachines Nb. if there is no a control plane object, the first FakeMachine gets a generated sa secret

func (*FakeCluster) Objs

func (f *FakeCluster) Objs() []runtime.Object

func (*FakeCluster) WithCloudConfigSecret added in v0.3.10

func (f *FakeCluster) WithCloudConfigSecret() *FakeCluster

func (*FakeCluster) WithControlPlane

func (f *FakeCluster) WithControlPlane(fakeControlPlane *FakeControlPlane) *FakeCluster

func (*FakeCluster) WithMachineDeployments

func (f *FakeCluster) WithMachineDeployments(fakeMachineDeployment ...*FakeMachineDeployment) *FakeCluster

func (*FakeCluster) WithMachinePools

func (f *FakeCluster) WithMachinePools(fakeMachinePool ...*FakeMachinePool) *FakeCluster

func (*FakeCluster) WithMachineSets

func (f *FakeCluster) WithMachineSets(fakeMachineSet ...*FakeMachineSet) *FakeCluster

func (*FakeCluster) WithMachines

func (f *FakeCluster) WithMachines(fakeMachine ...*FakeMachine) *FakeCluster

type FakeClusterResourceSet added in v0.3.7

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

func NewFakeClusterResourceSet added in v0.3.7

func NewFakeClusterResourceSet(namespace, name string) *FakeClusterResourceSet

NewFakeClusterResourceSet return a FakeClusterResourceSet that can generate a ClusterResourceSet object, all its own ancillary objects: - the Secret/ConfigMap defining resources - the bindings that are created when a ClusterResourceSet is applied to a cluster

func (*FakeClusterResourceSet) ApplyToCluster added in v0.3.7

func (f *FakeClusterResourceSet) ApplyToCluster(cluster *clusterv1.Cluster) *FakeClusterResourceSet

func (*FakeClusterResourceSet) Objs added in v0.3.7

func (*FakeClusterResourceSet) WithConfigMap added in v0.3.7

func (f *FakeClusterResourceSet) WithConfigMap(name string) *FakeClusterResourceSet

func (*FakeClusterResourceSet) WithSecret added in v0.3.7

type FakeControlPlane

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

func NewFakeControlPlane

func NewFakeControlPlane(name string) *FakeControlPlane

NewFakeControlPlane return a FakeControlPlane that can generate a controlPlane object, all its own ancillary objects: - the controlPlaneInfrastructure template object - the kubeconfig secret object - a generated sa secret and all the objects for the defined FakeMachines

func (*FakeControlPlane) Objs

func (f *FakeControlPlane) Objs(cluster *clusterv1.Cluster) []runtime.Object

func (*FakeControlPlane) WithMachines

func (f *FakeControlPlane) WithMachines(fakeMachine ...*FakeMachine) *FakeControlPlane

type FakeExternalObject added in v0.3.9

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

func NewFakeExternalObject added in v0.3.9

func NewFakeExternalObject(namespace, name string) *FakeExternalObject

func (*FakeExternalObject) Objs added in v0.3.9

func (f *FakeExternalObject) Objs() []runtime.Object

type FakeMachine

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

func NewFakeMachine

func NewFakeMachine(name string) *FakeMachine

NewFakeMachine return a FakeMachine that can generate a Machine object, all its own ancillary objects: - the machineInfrastructure object - the machineBootstrap object and the related bootstrapDataSecret If there is no a control plane object in the cluster, the first FakeMachine gets a generated sa secret

func (*FakeMachine) Objs

func (f *FakeMachine) Objs(cluster *clusterv1.Cluster, generateCerts bool, machineSet *clusterv1.MachineSet, controlPlane *fakecontrolplane.GenericControlPlane) []runtime.Object

type FakeMachineDeployment

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

func NewFakeMachineDeployment

func NewFakeMachineDeployment(name string) *FakeMachineDeployment

NewFakeMachineDeployment return a FakeMachineDeployment that can generate a MachineDeployment object, all its own ancillary objects: - the machineDeploymentInfrastructure template object - the machineDeploymentBootstrap template object and all the objects for the defined FakeMachineSet

func (*FakeMachineDeployment) Objs

func (*FakeMachineDeployment) WithInfrastructureTemplate

func (f *FakeMachineDeployment) WithInfrastructureTemplate(infrastructureTemplate *fakeinfrastructure.GenericInfrastructureMachineTemplate) *FakeMachineDeployment

func (*FakeMachineDeployment) WithMachineSets

func (f *FakeMachineDeployment) WithMachineSets(fakeMachineSet ...*FakeMachineSet) *FakeMachineDeployment

type FakeMachinePool

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

func NewFakeMachinePool

func NewFakeMachinePool(name string) *FakeMachinePool

NewFakeMachinePool return a FakeMachinePool that can generate a MachinePool object, all its own ancillary objects: - the machinePoolInfrastructure object - the machinePoolBootstrap object

func (*FakeMachinePool) Objs

func (f *FakeMachinePool) Objs(cluster *clusterv1.Cluster) []runtime.Object

type FakeMachineSet

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

func NewFakeMachineSet

func NewFakeMachineSet(name string) *FakeMachineSet

NewFakeMachineSet return a FakeMachineSet that can generate a MachineSet object, all its own ancillary objects: - the machineSetInfrastructure template object (only if not controlled by a MachineDeployment) - the machineSetBootstrap template object (only if not controlled by a MachineDeployment) and all the objects for the defined FakeMachine

func (*FakeMachineSet) Objs

func (f *FakeMachineSet) Objs(cluster *clusterv1.Cluster, machineDeployment *clusterv1.MachineDeployment) []runtime.Object

func (*FakeMachineSet) WithInfrastructureTemplate

func (f *FakeMachineSet) WithInfrastructureTemplate(infrastructureTemplate *fakeinfrastructure.GenericInfrastructureMachineTemplate) *FakeMachineSet

func (*FakeMachineSet) WithMachines

func (f *FakeMachineSet) WithMachines(fakeMachine ...*FakeMachine) *FakeMachineSet

type FakeProcessor added in v0.3.7

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

func NewFakeProcessor added in v0.3.7

func NewFakeProcessor() *FakeProcessor

func (*FakeProcessor) GetTemplateName added in v0.3.7

func (fp *FakeProcessor) GetTemplateName(version, flavor string) string

func (*FakeProcessor) GetVariables added in v0.3.7

func (fp *FakeProcessor) GetVariables(raw []byte) ([]string, error)

func (*FakeProcessor) Process added in v0.3.7

func (fp *FakeProcessor) Process(raw []byte, variablesGetter func(string) (string, error)) ([]byte, error)

func (*FakeProcessor) WithGetVariablesErr added in v0.3.7

func (fp *FakeProcessor) WithGetVariablesErr(e error) *FakeProcessor

func (*FakeProcessor) WithProcessErr added in v0.3.7

func (fp *FakeProcessor) WithProcessErr(e error) *FakeProcessor

func (*FakeProcessor) WithTemplateName added in v0.3.7

func (fp *FakeProcessor) WithTemplateName(n string) *FakeProcessor

type FakeProxy

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

func NewFakeProxy

func NewFakeProxy() *FakeProxy

func (*FakeProxy) CurrentNamespace

func (f *FakeProxy) CurrentNamespace() (string, error)

func (*FakeProxy) GetConfig added in v0.3.4

func (f *FakeProxy) GetConfig() (*rest.Config, error)

func (*FakeProxy) ListResources

func (f *FakeProxy) ListResources(labels map[string]string, namespaces ...string) ([]unstructured.Unstructured, error)

ListResources returns all the resources known by the FakeProxy

func (*FakeProxy) NewClient

func (f *FakeProxy) NewClient() (client.Client, error)

func (*FakeProxy) ValidateKubernetesVersion added in v0.3.4

func (f *FakeProxy) ValidateKubernetesVersion() error

func (*FakeProxy) WithFakeCAPISetup added in v0.3.15

func (f *FakeProxy) WithFakeCAPISetup() *FakeProxy

WithFakeCAPISetup adds required objects in order to make kubeadm pass checks ensuring that management cluster has a proper release of Cluster API installed. NOTE: When using the fake client it is not required to install CRDs, given that type information are derived from the schema. However, CheckCAPIContract looks for CRDs to be installed, so this helper provide a way to get around to this difference between fake client and a real API server.

func (*FakeProxy) WithNamespace added in v0.3.9

func (f *FakeProxy) WithNamespace(n string) *FakeProxy

func (*FakeProxy) WithObjs

func (f *FakeProxy) WithObjs(objs ...runtime.Object) *FakeProxy

func (*FakeProxy) WithProviderInventory

func (f *FakeProxy) WithProviderInventory(name string, providerType clusterctlv1.ProviderType, version, targetNamespace, watchingNamespace string) *FakeProxy

WithProviderInventory can be used as a fast track for setting up test scenarios requiring an already initialized management cluster. NB. this method adds an items to the Provider inventory, but it doesn't install the corresponding provider; if the test case requires the actual provider to be installed, use the the fake client to install both the provider components and the corresponding inventory item.

type FakeReader

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

FakeReader provider a reader implementation backed by a map

func NewFakeReader

func NewFakeReader() *FakeReader

func (*FakeReader) Get

func (f *FakeReader) Get(key string) (string, error)

func (*FakeReader) Init

func (f *FakeReader) Init(config string) error

func (*FakeReader) Set

func (f *FakeReader) Set(key, value string)

func (*FakeReader) UnmarshalKey

func (f *FakeReader) UnmarshalKey(key string, rawval interface{}) error

func (*FakeReader) WithImageMeta

func (f *FakeReader) WithImageMeta(component, repository, tag string) *FakeReader

func (*FakeReader) WithProvider

func (f *FakeReader) WithProvider(name string, ttype clusterctlv1.ProviderType, url string) *FakeReader

func (*FakeReader) WithVar

func (f *FakeReader) WithVar(key, value string) *FakeReader

type FakeRepository

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

func NewFakeRepository

func NewFakeRepository() *FakeRepository

func (*FakeRepository) ComponentsPath

func (f *FakeRepository) ComponentsPath() string

func (*FakeRepository) DefaultVersion

func (f *FakeRepository) DefaultVersion() string

func (FakeRepository) GetFile

func (f FakeRepository) GetFile(version string, path string) ([]byte, error)

func (*FakeRepository) GetVersions

func (f *FakeRepository) GetVersions() ([]string, error)

func (*FakeRepository) RootPath

func (f *FakeRepository) RootPath() string

func (*FakeRepository) WithDefaultVersion

func (f *FakeRepository) WithDefaultVersion(version string) *FakeRepository

func (*FakeRepository) WithFile

func (f *FakeRepository) WithFile(version, path string, content []byte) *FakeRepository

func (*FakeRepository) WithMetadata

func (f *FakeRepository) WithMetadata(version string, metadata *clusterctlv1.Metadata) *FakeRepository

func (*FakeRepository) WithPaths

func (f *FakeRepository) WithPaths(rootPath, componentsPath string) *FakeRepository

func (*FakeRepository) WithVersions

func (f *FakeRepository) WithVersions(version ...string) *FakeRepository

type FakeVariableClient

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

FakeVariableClient provides a VariableClient backed by a map

func NewFakeVariableClient

func NewFakeVariableClient() *FakeVariableClient

func (FakeVariableClient) Get

func (f FakeVariableClient) Get(key string) (string, error)

func (FakeVariableClient) Set

func (f FakeVariableClient) Set(key, value string)

func (*FakeVariableClient) WithVar

func (f *FakeVariableClient) WithVar(key, value string) *FakeVariableClient

Directories

Path Synopsis
providers
bootstrap
package bootstrap defines the types for a generic bootstrap provider used for tests +kubebuilder:object:generate=true +groupName=bootstrap.cluster.x-k8s.io
package bootstrap defines the types for a generic bootstrap provider used for tests +kubebuilder:object:generate=true +groupName=bootstrap.cluster.x-k8s.io
controlplane
package controlplane defines the types for a generic control plane provider used for tests +kubebuilder:object:generate=true +groupName=controlplane.cluster.x-k8s.io
package controlplane defines the types for a generic control plane provider used for tests +kubebuilder:object:generate=true +groupName=controlplane.cluster.x-k8s.io
external
package external defines the types for a generic external provider used for tests +kubebuilder:object:generate=true +groupName=custom.cluster.x-k8s.io
package external defines the types for a generic external provider used for tests +kubebuilder:object:generate=true +groupName=custom.cluster.x-k8s.io
infrastructure
package infrastructure defines the types for a generic infrastructure provider used for tests +kubebuilder:object:generate=true +groupName=infrastructure.cluster.x-k8s.io
package infrastructure defines the types for a generic infrastructure provider used for tests +kubebuilder:object:generate=true +groupName=infrastructure.cluster.x-k8s.io

Jump to

Keyboard shortcuts

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