Documentation ¶
Overview ¶
Package test implements test functionality.
Index ¶
- Constants
- Variables
- func FakeCAPISetupObjects() []client.Object
- func FakeCRDList() []*apiextensionsv1.CustomResourceDefinition
- func FakeClusterCustomResourceDefinition(group string, kind string, versions ...string) *apiextensionsv1.CustomResourceDefinition
- func FakeNamespacedCustomResourceDefinition(group string, kind string, versions ...string) *apiextensionsv1.CustomResourceDefinition
- func NewFakeGitHub() (client *github.Client, mux *http.ServeMux, teardown func())
- func NewFakeInfrastructureTemplate(name string) *fakeinfrastructure.GenericInfrastructureMachineTemplate
- func NewSecret(namespace, name string) *corev1.Secret
- func SelectClusterObj(objs []client.Object, namespace, name string) *clusterv1.Cluster
- type FakeCluster
- func (f *FakeCluster) Objs() []client.Object
- func (f *FakeCluster) WithCloudConfigSecret() *FakeCluster
- func (f *FakeCluster) WithControlPlane(fakeControlPlane *FakeControlPlane) *FakeCluster
- func (f *FakeCluster) WithCredentialSecret() *FakeCluster
- func (f *FakeCluster) WithMachineDeployments(fakeMachineDeployment ...*FakeMachineDeployment) *FakeCluster
- func (f *FakeCluster) WithMachinePools(fakeMachinePool ...*FakeMachinePool) *FakeCluster
- func (f *FakeCluster) WithMachineSets(fakeMachineSet ...*FakeMachineSet) *FakeCluster
- func (f *FakeCluster) WithMachines(fakeMachine ...*FakeMachine) *FakeCluster
- type FakeClusterExternalObject
- type FakeClusterInfrastructureIdentity
- type FakeClusterResourceSet
- func (f *FakeClusterResourceSet) ApplyToCluster(cluster *clusterv1.Cluster) *FakeClusterResourceSet
- func (f *FakeClusterResourceSet) Objs() []client.Object
- func (f *FakeClusterResourceSet) WithConfigMap(name string) *FakeClusterResourceSet
- func (f *FakeClusterResourceSet) WithSecret(name string) *FakeClusterResourceSet
- type FakeControlPlane
- type FakeExternalObject
- type FakeMachine
- type FakeMachineDeployment
- type FakeMachinePool
- type FakeMachineSet
- type FakeProcessor
- func (fp *FakeProcessor) GetTemplateName(version, flavor string) string
- func (fp *FakeProcessor) GetVariableMap(raw []byte) (map[string]*string, error)
- func (fp *FakeProcessor) GetVariables(raw []byte) ([]string, error)
- func (fp *FakeProcessor) Process(raw []byte, variablesGetter func(string) (string, error)) ([]byte, error)
- func (fp *FakeProcessor) WithGetVariablesErr(e error) *FakeProcessor
- func (fp *FakeProcessor) WithProcessErr(e error) *FakeProcessor
- func (fp *FakeProcessor) WithTemplateName(n string) *FakeProcessor
- type FakeProxy
- func (f *FakeProxy) CurrentNamespace() (string, error)
- func (f *FakeProxy) GetConfig() (*rest.Config, error)
- func (f *FakeProxy) ListResources(labels map[string]string, namespaces ...string) ([]unstructured.Unstructured, error)
- func (f *FakeProxy) NewClient() (client.Client, error)
- func (f *FakeProxy) ValidateKubernetesVersion() error
- func (f *FakeProxy) WithFakeCAPISetup() *FakeProxy
- func (f *FakeProxy) WithNamespace(n string) *FakeProxy
- func (f *FakeProxy) WithObjs(objs ...client.Object) *FakeProxy
- func (f *FakeProxy) WithProviderInventory(name string, providerType clusterctlv1.ProviderType, ...) *FakeProxy
- type FakeReader
- func (f *FakeReader) Get(key string) (string, error)
- func (f *FakeReader) Init(config string) error
- func (f *FakeReader) Set(key, value string)
- func (f *FakeReader) UnmarshalKey(key string, rawval interface{}) error
- func (f *FakeReader) WithCertManager(url, version, timeout string) *FakeReader
- func (f *FakeReader) WithImageMeta(component, repository, tag string) *FakeReader
- func (f *FakeReader) WithProvider(name string, ttype clusterctlv1.ProviderType, url string) *FakeReader
- func (f *FakeReader) WithVar(key, value string) *FakeReader
- type FakeVariableClient
Constants ¶
const NextCAPIContractNotSupported = "v99"
NextCAPIContractNotSupported define the next Cluster API contract, not supported by this release of clusterctl.
Variables ¶
var CurrentCAPIContract = clusterv1.GroupVersion.Version
CurrentCAPIContract define the current Cluster API contract.
var (
FakeScheme = runtime.NewScheme() //nolint:revive
)
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
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 ¶
func FakeCRDList() []*apiextensionsv1.CustomResourceDefinition
FakeCRDList returns FakeCustomResourceDefinitions for all the Types used in the test object graph.
func FakeClusterCustomResourceDefinition ¶ added in v0.4.0
func FakeClusterCustomResourceDefinition(group string, kind string, versions ...string) *apiextensionsv1.CustomResourceDefinition
FakeClusterCustomResourceDefinition returns a fake CRD object for the given group/versions/kind.
func FakeNamespacedCustomResourceDefinition ¶ added in v0.4.0
func FakeNamespacedCustomResourceDefinition(group string, kind string, versions ...string) *apiextensionsv1.CustomResourceDefinition
FakeNamespacedCustomResourceDefinition returns a fake CRD object for the given group/versions/kind.
func NewFakeGitHub ¶
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 NewFakeInfrastructureTemplate ¶
func NewFakeInfrastructureTemplate(name string) *fakeinfrastructure.GenericInfrastructureMachineTemplate
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() []client.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) WithCredentialSecret ¶ added in v0.4.0
func (f *FakeCluster) WithCredentialSecret() *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 FakeClusterExternalObject ¶ added in v0.4.0
type FakeClusterExternalObject struct {
// contains filtered or unexported fields
}
func NewFakeClusterExternalObject ¶ added in v0.4.0
func NewFakeClusterExternalObject(name string) *FakeClusterExternalObject
NewFakeClusterExternalObject generates a new global external object (a CR not related to the Cluster).
func (*FakeClusterExternalObject) Objs ¶ added in v0.4.0
func (f *FakeClusterExternalObject) Objs() []client.Object
type FakeClusterInfrastructureIdentity ¶ added in v0.4.0
type FakeClusterInfrastructureIdentity struct {
// contains filtered or unexported fields
}
func NewFakeClusterInfrastructureIdentity ¶ added in v0.4.0
func NewFakeClusterInfrastructureIdentity(name string) *FakeClusterInfrastructureIdentity
NewFakeClusterInfrastructureIdentity generates a new global cluster identity object.
func (*FakeClusterInfrastructureIdentity) Objs ¶ added in v0.4.0
func (f *FakeClusterInfrastructureIdentity) Objs() []client.Object
func (*FakeClusterInfrastructureIdentity) WithSecretIn ¶ added in v0.4.0
func (f *FakeClusterInfrastructureIdentity) WithSecretIn(namespace string) *FakeClusterInfrastructureIdentity
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 (f *FakeClusterResourceSet) Objs() []client.Object
func (*FakeClusterResourceSet) WithConfigMap ¶ added in v0.3.7
func (f *FakeClusterResourceSet) WithConfigMap(name string) *FakeClusterResourceSet
func (*FakeClusterResourceSet) WithSecret ¶ added in v0.3.7
func (f *FakeClusterResourceSet) WithSecret(name string) *FakeClusterResourceSet
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) []client.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
NewFakeExternalObject generates a new external object (a CR not related to the Cluster).
func (*FakeExternalObject) Objs ¶ added in v0.3.9
func (f *FakeExternalObject) Objs() []client.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) []client.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 (f *FakeMachineDeployment) Objs(cluster *clusterv1.Cluster) []client.Object
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.
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) []client.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) GetVariableMap ¶ added in v0.4.0
func (fp *FakeProcessor) GetVariableMap(raw []byte) (map[string]*string, error)
func (*FakeProcessor) GetVariables ¶ added in v0.3.7
func (fp *FakeProcessor) GetVariables(raw []byte) ([]string, 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 (*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) ValidateKubernetesVersion ¶ added in v0.3.4
func (*FakeProxy) WithFakeCAPISetup ¶ added in v0.3.15
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 (*FakeProxy) WithProviderInventory ¶
func (f *FakeProxy) WithProviderInventory(name string, providerType clusterctlv1.ProviderType, version, targetNamespace 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) 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) WithCertManager ¶ added in v0.4.0
func (f *FakeReader) WithCertManager(url, version, timeout string) *FakeReader
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 FakeVariableClient ¶
type FakeVariableClient struct {
// contains filtered or unexported fields
}
FakeVariableClient provides a VariableClient backed by a map.
func NewFakeVariableClient ¶
func NewFakeVariableClient() *FakeVariableClient
func (FakeVariableClient) Set ¶
func (f FakeVariableClient) Set(key, value string)
func (*FakeVariableClient) WithVar ¶
func (f *FakeVariableClient) WithVar(key, value string) *FakeVariableClient
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
providers
|
|
bootstrap
Package bootstrap defines the types for a generic bootstrap provider used for tests.
|
Package bootstrap defines the types for a generic bootstrap provider used for tests. |
controlplane
Package controlplane defines the types for a generic control plane provider used for tests.
|
Package controlplane defines the types for a generic control plane provider used for tests. |
external
Package external defines the types for a generic external provider used for tests.
|
Package external defines the types for a generic external provider used for tests. |
infrastructure
Package infrastructure defines the types for a generic infrastructure provider used for tests.
|
Package infrastructure defines the types for a generic infrastructure provider used for tests. |