import "sigs.k8s.io/cluster-api/cmd/clusterctl/internal/test"
fake_github.go fake_objects.go fake_processor.go fake_proxy.go fake_reader.go fake_repository.go fake_variable_client.go
func FakeCRDList() []*apiextensionslv1.CustomResourceDefinition
FakeCRDList returns FakeCustomResourceDefinitions for all the Types used in the test object graph
func FakeCustomResourceDefinition(group string, kind string, versions ...string) *apiextensionslv1.CustomResourceDefinition
FakeCustomResourceDefinition returns a fake CRD object for the given group/versions/kind.
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(name string) *fakeinfrastructure.GenericInfrastructureMachineTemplate
type FakeCluster struct {
// contains filtered or unexported fields
}
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 (f *FakeCluster) Objs() []client.Object
func (f *FakeCluster) WithCloudConfigSecret() *FakeCluster
func (f *FakeCluster) WithControlPlane(fakeControlPlane *FakeControlPlane) *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 FakeClusterResourceSet struct {
// contains filtered or unexported fields
}
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 (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 struct {
// contains filtered or unexported fields
}
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 (f *FakeControlPlane) WithMachines(fakeMachine ...*FakeMachine) *FakeControlPlane
type FakeExternalObject struct {
// contains filtered or unexported fields
}
func NewFakeExternalObject(namespace, name string) *FakeExternalObject
func (f *FakeExternalObject) Objs() []client.Object
type FakeMachine struct {
// contains filtered or unexported fields
}
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 (f *FakeMachine) Objs(cluster *clusterv1.Cluster, generateCerts bool, machineSet *clusterv1.MachineSet, controlPlane *fakecontrolplane.GenericControlPlane) []client.Object
type FakeMachineDeployment struct {
// contains filtered or unexported fields
}
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 (f *FakeMachineDeployment) WithInfrastructureTemplate(infrastructureTemplate *fakeinfrastructure.GenericInfrastructureMachineTemplate) *FakeMachineDeployment
func (f *FakeMachineDeployment) WithMachineSets(fakeMachineSet ...*FakeMachineSet) *FakeMachineDeployment
type FakeMachinePool struct {
// contains filtered or unexported fields
}
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 struct {
// contains filtered or unexported fields
}
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 (f *FakeMachineSet) Objs(cluster *clusterv1.Cluster, machineDeployment *clusterv1.MachineDeployment) []client.Object
func (f *FakeMachineSet) WithInfrastructureTemplate(infrastructureTemplate *fakeinfrastructure.GenericInfrastructureMachineTemplate) *FakeMachineSet
func (f *FakeMachineSet) WithMachines(fakeMachine ...*FakeMachine) *FakeMachineSet
type FakeProcessor struct {
// contains filtered or unexported fields
}
func NewFakeProcessor() *FakeProcessor
func (fp *FakeProcessor) GetTemplateName(version, flavor string) string
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 struct {
// contains filtered or unexported fields
}
func (f *FakeProxy) ListResources(labels map[string]string, namespaces ...string) ([]unstructured.Unstructured, error)
ListResources returns all the resources known by the FakeProxy
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 struct {
// contains filtered or unexported fields
}
FakeReader provider a reader implementation backed by a map
func NewFakeReader() *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) 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 FakeRepository struct {
// contains filtered or unexported fields
}
func NewFakeRepository() *FakeRepository
func (f *FakeRepository) ComponentsPath() string
func (f *FakeRepository) DefaultVersion() string
func (f *FakeRepository) GetVersions() ([]string, error)
func (f *FakeRepository) RootPath() string
func (f *FakeRepository) WithDefaultVersion(version string) *FakeRepository
func (f *FakeRepository) WithFile(version, path string, content []byte) *FakeRepository
func (f *FakeRepository) WithMetadata(version string, metadata *clusterctlv1.Metadata) *FakeRepository
func (f *FakeRepository) WithPaths(rootPath, componentsPath string) *FakeRepository
func (f *FakeRepository) WithVersions(version ...string) *FakeRepository
type FakeVariableClient struct {
// contains filtered or unexported fields
}
FakeVariableClient provides a VariableClient backed by a map
func NewFakeVariableClient() *FakeVariableClient
func (f FakeVariableClient) Get(key string) (string, error)
func (f FakeVariableClient) Set(key, value string)
func (f *FakeVariableClient) WithVar(key, value string) *FakeVariableClient
Path | Synopsis |
---|---|
providers/bootstrap | package bootstrap defines the types for a generic bootstrap provider used for tests |
providers/controlplane | package controlplane defines the types for a generic control plane provider used for tests |
providers/external | package external defines the types for a generic external provider used for tests |
providers/infrastructure | package 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-12-29. Refresh now. Tools for package owners.