cluster-api: sigs.k8s.io/cluster-api/cmd/clusterctl/internal/test Index | Files | Directories

package test

import "sigs.k8s.io/cluster-api/cmd/clusterctl/internal/test"

Index

Package Files

fake_github.go fake_objects.go fake_processor.go fake_proxy.go fake_reader.go fake_repository.go fake_variable_client.go

Variables

var (
    FakeScheme = runtime.NewScheme()
)

func FakeCRDList Uses

func FakeCRDList() []*apiextensionslv1.CustomResourceDefinition

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

func FakeCustomResourceDefinition Uses

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

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

func NewFakeGitHub Uses

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 NewFakeInfrastructureTemplate Uses

func NewFakeInfrastructureTemplate(name string) *fakeinfrastructure.GenericInfrastructureMachineTemplate

func SelectClusterObj Uses

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

type FakeCluster Uses

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

func NewFakeCluster Uses

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 Uses

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

func (*FakeCluster) WithCloudConfigSecret Uses

func (f *FakeCluster) WithCloudConfigSecret() *FakeCluster

func (*FakeCluster) WithControlPlane Uses

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

func (*FakeCluster) WithMachineDeployments Uses

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

func (*FakeCluster) WithMachinePools Uses

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

func (*FakeCluster) WithMachineSets Uses

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

func (*FakeCluster) WithMachines Uses

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

type FakeClusterResourceSet Uses

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

func NewFakeClusterResourceSet Uses

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 Uses

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

func (*FakeClusterResourceSet) Objs Uses

func (f *FakeClusterResourceSet) Objs() []client.Object

func (*FakeClusterResourceSet) WithConfigMap Uses

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

func (*FakeClusterResourceSet) WithSecret Uses

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

type FakeControlPlane Uses

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

func NewFakeControlPlane Uses

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 Uses

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

func (*FakeControlPlane) WithMachines Uses

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

type FakeExternalObject Uses

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

func NewFakeExternalObject Uses

func NewFakeExternalObject(namespace, name string) *FakeExternalObject

func (*FakeExternalObject) Objs Uses

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

type FakeMachine Uses

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

func NewFakeMachine Uses

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 Uses

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

type FakeMachineDeployment Uses

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

func NewFakeMachineDeployment Uses

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 Uses

func (f *FakeMachineDeployment) Objs(cluster *clusterv1.Cluster) []client.Object

func (*FakeMachineDeployment) WithInfrastructureTemplate Uses

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

func (*FakeMachineDeployment) WithMachineSets Uses

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

type FakeMachinePool Uses

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

func NewFakeMachinePool Uses

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 Uses

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

type FakeMachineSet Uses

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

func NewFakeMachineSet Uses

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 Uses

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

func (*FakeMachineSet) WithInfrastructureTemplate Uses

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

func (*FakeMachineSet) WithMachines Uses

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

type FakeProcessor Uses

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

func NewFakeProcessor Uses

func NewFakeProcessor() *FakeProcessor

func (*FakeProcessor) GetTemplateName Uses

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

func (*FakeProcessor) GetVariables Uses

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

func (*FakeProcessor) Process Uses

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

func (*FakeProcessor) WithGetVariablesErr Uses

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

func (*FakeProcessor) WithProcessErr Uses

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

func (*FakeProcessor) WithTemplateName Uses

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

type FakeProxy Uses

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

func NewFakeProxy Uses

func NewFakeProxy() *FakeProxy

func (*FakeProxy) CurrentNamespace Uses

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

func (*FakeProxy) GetConfig Uses

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

func (*FakeProxy) ListResources Uses

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 Uses

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

func (*FakeProxy) ValidateKubernetesVersion Uses

func (f *FakeProxy) ValidateKubernetesVersion() error

func (*FakeProxy) WithNamespace Uses

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

func (*FakeProxy) WithObjs Uses

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

func (*FakeProxy) WithProviderInventory Uses

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 Uses

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

FakeReader provider a reader implementation backed by a map

func NewFakeReader Uses

func NewFakeReader() *FakeReader

func (*FakeReader) Get Uses

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

func (*FakeReader) Init Uses

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

func (*FakeReader) Set Uses

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

func (*FakeReader) UnmarshalKey Uses

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

func (*FakeReader) WithImageMeta Uses

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

func (*FakeReader) WithProvider Uses

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

func (*FakeReader) WithVar Uses

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

type FakeRepository Uses

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

func NewFakeRepository Uses

func NewFakeRepository() *FakeRepository

func (*FakeRepository) ComponentsPath Uses

func (f *FakeRepository) ComponentsPath() string

func (*FakeRepository) DefaultVersion Uses

func (f *FakeRepository) DefaultVersion() string

func (FakeRepository) GetFile Uses

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

func (*FakeRepository) GetVersions Uses

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

func (*FakeRepository) RootPath Uses

func (f *FakeRepository) RootPath() string

func (*FakeRepository) WithDefaultVersion Uses

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

func (*FakeRepository) WithFile Uses

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

func (*FakeRepository) WithMetadata Uses

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

func (*FakeRepository) WithPaths Uses

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

func (*FakeRepository) WithVersions Uses

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

type FakeVariableClient Uses

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

FakeVariableClient provides a VariableClient backed by a map

func NewFakeVariableClient Uses

func NewFakeVariableClient() *FakeVariableClient

func (FakeVariableClient) Get Uses

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

func (FakeVariableClient) Set Uses

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

func (*FakeVariableClient) WithVar Uses

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

Directories

PathSynopsis
providers/bootstrappackage bootstrap defines the types for a generic bootstrap provider used for tests
providers/controlplanepackage controlplane defines the types for a generic control plane provider used for tests
providers/externalpackage external defines the types for a generic external provider used for tests
providers/infrastructurepackage infrastructure defines the types for a generic infrastructure provider used for tests

Package test imports 28 packages (graph) and is imported by 2 packages. Updated 2020-10-16. Refresh now. Tools for package owners.