Documentation ¶
Overview ¶
Package helper implements helper functions used for unit tests
Index ¶
- func CreateDummyClusterObjects(clusterName, namespace string) []runtime.Object
- func CreateTempTestingDirectory() string
- func DeleteTempTestingDirectory(testingDir string)
- func GetAllCAPIClusterObjects(options TestAllClusterComponentOptions) []runtime.Object
- func GetAllPacificClusterObjects(options TestAllClusterComponentOptions) []runtime.Object
- func GetFakeClusterInfo(server string, cert *x509.Certificate) string
- func GetFakeKubeConfigFilePath(testingDir, filePath string) string
- func GetFakePinnipedInfo(pinnipedInfo PinnipedInfo) string
- func NewAWSCluster(awsClusterOptions TestAWSClusterOptions) runtime.Object
- func NewAWSMachineTemplate(templateOptions TestObject) runtime.Object
- func NewAzureMachineTemplate(templateOptions TestObject) runtime.Object
- func NewCluster(options TestAllClusterComponentOptions) *capi.Cluster
- func NewClusterAPIAWSControllerComponents() []runtime.Object
- func NewClusterRole(options TestClusterRoleOption) runtime.Object
- func NewClusterRoleBinding(options TestClusterRoleBindingOption) runtime.Object
- func NewDaemonSet(options TestDaemonSetOption) runtime.Object
- func NewDeployment(options TestDeploymentOption) runtime.Object
- func NewInfrastructureComponents(options TestAllClusterComponentOptions) []runtime.Object
- func NewInfrastructureMachineTemplate(templateOptions TestObject) runtime.Object
- func NewInfrastructureTemplates(options TestAllClusterComponentOptions) []runtime.Object
- func NewKCP(options TestAllClusterComponentOptions) runtime.Object
- func NewMD(options TestAllClusterComponentOptions) []runtime.Object
- func NewMDForPacific(options TestAllClusterComponentOptions) runtime.Object
- func NewMachineHealthCheck(options TestMachineHealthCheckOption) *capi.MachineHealthCheck
- func NewMachines(options TestAllClusterComponentOptions) []runtime.Object
- func NewMachinesForPacific(options TestAllClusterComponentOptions) []runtime.Object
- func NewPacificCluster(options TestAllClusterComponentOptions) runtime.Object
- func NewServiceAccount(options TestServiceAccountOption) runtime.Object
- func NewVSphereMachineTemplate(templateOptions TestObject) runtime.Object
- type PinnipedInfo
- type TestAWSClusterOptions
- type TestAllClusterComponentOptions
- type TestCPOptions
- type TestClusterConfiguration
- type TestClusterOptions
- type TestClusterRoleBindingOption
- type TestClusterRoleOption
- type TestConfigMapOption
- type TestDaemonSetOption
- type TestDeploymentOption
- type TestInfraComponentsOptions
- type TestMDOptions
- type TestMachineHealthCheckOption
- type TestMachineOptions
- type TestObject
- type TestServiceAccountOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDummyClusterObjects ¶
CreateDummyClusterObjects creates the dummy CAPI Cluster objects use this function when cluster configuration is not that important
func CreateTempTestingDirectory ¶
func CreateTempTestingDirectory() string
CreateTempTestingDirectory create temporary directory for testing
func DeleteTempTestingDirectory ¶
func DeleteTempTestingDirectory(testingDir string)
DeleteTempTestingDirectory deletes temporary directory
func GetAllCAPIClusterObjects ¶
func GetAllCAPIClusterObjects(options TestAllClusterComponentOptions) []runtime.Object
GetAllCAPIClusterObjects returns list of runtime.Objects for CAPI cluster includes: v1aplha3.Cluster, v1aplha3.KubeadmControlPlane v1aplha3.MachineDeployment, []v1aplha2.Machine
func GetAllPacificClusterObjects ¶
func GetAllPacificClusterObjects(options TestAllClusterComponentOptions) []runtime.Object
GetAllPacificClusterObjects returns list of runtime.Objects for pacific cluster includes: TanzuKubernetesCluster, v1aplha2.MachineDeployment, []v1aplha2.Machine
func GetFakeClusterInfo ¶
func GetFakeClusterInfo(server string, cert *x509.Certificate) string
GetFakeClusterInfo returns the cluster-info configmap
func GetFakeKubeConfigFilePath ¶
GetFakeKubeConfigFilePath returns fake kubeconfig file path
func GetFakePinnipedInfo ¶
func GetFakePinnipedInfo(pinnipedInfo PinnipedInfo) string
GetFakePinnipedInfo returns the pinniped-info configmap
func NewAWSCluster ¶
func NewAWSCluster(awsClusterOptions TestAWSClusterOptions) runtime.Object
func NewAWSMachineTemplate ¶
func NewAWSMachineTemplate(templateOptions TestObject) runtime.Object
NewAWSMachineTemplate returns new AWSMachineTemplate
func NewAzureMachineTemplate ¶
func NewAzureMachineTemplate(templateOptions TestObject) runtime.Object
NewAzureMachineTemplate returns new AzureMachineTemplate
func NewCluster ¶
func NewCluster(options TestAllClusterComponentOptions) *capi.Cluster
NewCluster returns a CAPI v1aplha3.Cluster object
func NewClusterAPIAWSControllerComponents ¶
NewClusterAPIAWSControllerComponents inserts a minimal fake of Cluster API Provider AWS controller objects for testing.
func NewClusterRole ¶
func NewClusterRole(options TestClusterRoleOption) runtime.Object
NewClusterRole returns new cluster role from options
func NewClusterRoleBinding ¶
func NewClusterRoleBinding(options TestClusterRoleBindingOption) runtime.Object
NewClusterRoleBinding returns new cluster role binding object from options
func NewDaemonSet ¶
func NewDaemonSet(options TestDaemonSetOption) runtime.Object
NewDaemonSet returns new daemonset object from options
func NewDeployment ¶
func NewDeployment(options TestDeploymentOption) runtime.Object
NewDeployment returns new deployment object from options
func NewInfrastructureComponents ¶
func NewInfrastructureComponents(options TestAllClusterComponentOptions) []runtime.Object
func NewInfrastructureMachineTemplate ¶
func NewInfrastructureMachineTemplate(templateOptions TestObject) runtime.Object
NewInfrastructureMachineTemplate returns new Machine template based on infa
func NewInfrastructureTemplates ¶
func NewInfrastructureTemplates(options TestAllClusterComponentOptions) []runtime.Object
NewInfrastructureTemplates returns new InfrastructureMachine objects
func NewKCP ¶
func NewKCP(options TestAllClusterComponentOptions) runtime.Object
NewKCP returns a CAPI v1aplha3.KubeadmControlPlane object
func NewMD ¶
func NewMD(options TestAllClusterComponentOptions) []runtime.Object
NewMD returns a CAPI v1aplha3.MachineDeployment object
func NewMDForPacific ¶
func NewMDForPacific(options TestAllClusterComponentOptions) runtime.Object
NewMDForPacific returns new v1aplha2.MachineDeployment object
func NewMachineHealthCheck ¶
func NewMachineHealthCheck(options TestMachineHealthCheckOption) *capi.MachineHealthCheck
NewMachineHealthCheck returns new MachineHealthCheck object
func NewMachines ¶
func NewMachines(options TestAllClusterComponentOptions) []runtime.Object
NewMachines returns new []v1aplha3.Machine objects
func NewMachinesForPacific ¶
func NewMachinesForPacific(options TestAllClusterComponentOptions) []runtime.Object
NewMachinesForPacific returns new []v1aplha2.Machine objects
func NewPacificCluster ¶
func NewPacificCluster(options TestAllClusterComponentOptions) runtime.Object
NewPacificCluster returns new TanzuKubernetesCluster object
func NewServiceAccount ¶
func NewServiceAccount(options TestServiceAccountOption) runtime.Object
NewServiceAccount returns new service account from options
func NewVSphereMachineTemplate ¶
func NewVSphereMachineTemplate(templateOptions TestObject) runtime.Object
NewVSphereMachineTemplate returns new VSphereMachineTemplate
Types ¶
type PinnipedInfo ¶ added in v0.9.0
type PinnipedInfo struct { ClusterName string `json:"cluster_name"` Issuer string `json:"issuer"` IssuerCABundleData string `json:"issuer_ca_bundle_data"` ConciergeIsClusterScoped bool `json:"concierge_is_cluster_scoped,string"` }
PinnipedInfo contains settings for the supervisor.
type TestAWSClusterOptions ¶
type TestAllClusterComponentOptions ¶
type TestAllClusterComponentOptions struct { ClusterName string Namespace string Labels map[string]string ClusterOptions TestClusterOptions CPOptions TestCPOptions ListMDOptions []TestMDOptions MachineOptions []TestMachineOptions ClusterConfigurationOptions TestClusterConfiguration InfraComponentsOptions TestInfraComponentsOptions }
TestAllClusterComponentOptions describes options for Cluster creation with all it's dependent components
type TestCPOptions ¶
type TestCPOptions struct { SpecReplicas int32 ReadyReplicas int32 UpdatedReplicas int32 Replicas int32 K8sVersion string InfrastructureTemplate TestObject }
TestCPOptions describes options for ControlPlane This applies to KCP for CAPI and TKC.Spec.Topology.ControlPlane for TKC cluster
type TestClusterOptions ¶
type TestClusterOptions struct { Phase string InfrastructureReady bool ControlPlaneInitialized bool ControlPlaneReady bool OperationType string OperationtTimeout int // seconds StartTimestamp string LastObservedTimestamp string }
TestClusterOptions describes options for CAPI/TKC cluster
type TestClusterRoleBindingOption ¶
type TestClusterRoleBindingOption struct {
Name string
}
TestClusterRoleBindingOption describes options for ClusterRoleBinding
type TestClusterRoleOption ¶
type TestClusterRoleOption struct {
Name string
}
TestClusterRoleOption describes options for ClusterRole
type TestConfigMapOption ¶
TestConfigMapOption describes options for ConfigMap
type TestDaemonSetOption ¶
TestDaemonSetOption describes options for DaemonSet
type TestDeploymentOption ¶
TestDeploymentOption describes options for Deployment
type TestInfraComponentsOptions ¶
type TestInfraComponentsOptions struct {
AWSCluster *TestAWSClusterOptions
}
type TestMDOptions ¶
type TestMDOptions struct { SpecReplicas int32 ReadyReplicas int32 UpdatedReplicas int32 Replicas int32 InfrastructureTemplate TestObject }
TestMDOptions describes options for MachineDeployment
func GetListMDOptionsFromMDOptions ¶
func GetListMDOptionsFromMDOptions(options ...TestMDOptions) []TestMDOptions
GetListMDOptionsFromMDOptions returns list from MDOptions
type TestMachineHealthCheckOption ¶
TestMachineHealthCheckOption describes options for MachineHealthCheck
type TestMachineOptions ¶
TestMachineOptions describes options for Machine
type TestObject ¶
TestObject describes options for Infrastructure Template
type TestServiceAccountOption ¶
TestServiceAccountOption describe options for ServiceAccount