test

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FakeScheme = runtime.NewScheme()
)

Functions

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 TestMethod

func TestMethod(t *testing.T, r *http.Request, want string)

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) 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 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 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.DummyControlPlane) []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.DummyInfrastructureMachineTemplate) *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.DummyInfrastructureMachineTemplate) *FakeMachineSet

func (*FakeMachineSet) WithMachines

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

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) 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 dummy bootstrap provider used for tests +kubebuilder:object:generate=true +groupName=bootstrap.cluster.x-k8s.io
package bootstrap defines the types for dummy bootstrap provider used for tests +kubebuilder:object:generate=true +groupName=bootstrap.cluster.x-k8s.io
controlplane
package controlplane defines the types for dummy control plane provider used for tests +kubebuilder:object:generate=true +groupName=controlplane.cluster.x-k8s.io
package controlplane defines the types for dummy control plane provider used for tests +kubebuilder:object:generate=true +groupName=controlplane.cluster.x-k8s.io
infrastructure
package infrastructure defines the types for dummy infrastructure provider used for tests +kubebuilder:object:generate=true +groupName=infrastructure.cluster.x-k8s.io
package infrastructure defines the types for dummy 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