helper

package
v0.0.0-...-b25b198 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package helper implements helper functions used for unit tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDummyClusterObjects

func CreateDummyClusterObjects(clusterName, namespace string) []runtime.Object

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

func GetFakeKubeConfigFilePath(testingDir, filePath string) string

GetFakeKubeConfigFilePath returns fake kubeconfig file path

func GetFakePinnipedInfo

func GetFakePinnipedInfo(pinnipedInfo 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 NewCLIPlugin

func NewCLIPlugin(options TestCLIPluginOption) v1alpha1.CLIPlugin

NewCLIPlugin returns new NewCLIPlugin object

func NewCluster

func NewCluster(options TestAllClusterComponentOptions) *capi.Cluster

NewCluster returns a CAPI v1aplha3.Cluster object

func NewClusterAPIAWSControllerComponents

func NewClusterAPIAWSControllerComponents() []runtime.Object

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

NewKCP returns a CAPI v1aplha3.KubeadmControlPlane object

func NewMD

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 TestAWSClusterOptions

type TestAWSClusterOptions struct {
	Name      string
	Namespace string
	Region    string
}

type TestAllClusterComponentOptions

type TestAllClusterComponentOptions struct {
	ClusterName                 string
	Namespace                   string
	Labels                      map[string]string
	ClusterOptions              TestClusterOptions
	CPOptions                   TestCPOptions
	ListMDOptions               []TestMDOptions
	MachineOptions              []TestMachineOptions
	ClusterConfigurationOptions TestClusterConfiguration
	ClusterTopology             TestClusterTopology
	InfraComponentsOptions      TestInfraComponentsOptions
}

TestAllClusterComponentOptions describes options for Cluster creation with all it's dependent components

type TestCLIPluginOption

type TestCLIPluginOption struct {
	Name               string
	Description        string
	RecommendedVersion string
}

TestCLIPluginOption describes options for CLIPlugin

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 TestClusterConfiguration

type TestClusterConfiguration struct {
	ImageRepository     string
	DNSImageRepository  string
	DNSImageTag         string
	EtcdLocalDataDir    string
	EtcdImageRepository string
	EtcdImageTag        string
}

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 TestClusterTopology

type TestClusterTopology struct {
	Class   string
	Version string
}

type TestConfigMapOption

type TestConfigMapOption struct {
	Name      string
	Namespace string
}

TestConfigMapOption describes options for ConfigMap

type TestDaemonSetOption

type TestDaemonSetOption struct {
	Name             string
	Namespace        string
	Image            string
	IncludeContainer bool
}

TestDaemonSetOption describes options for DaemonSet

type TestDeploymentOption

type TestDeploymentOption struct {
	Name      string
	Namespace string
}

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

type TestMachineHealthCheckOption struct {
	Name        string
	Namespace   string
	ClusterName string
}

TestMachineHealthCheckOption describes options for MachineHealthCheck

type TestMachineOptions

type TestMachineOptions struct {
	Phase      string
	K8sVersion string
	IsCP       bool
}

TestMachineOptions describes options for Machine

type TestObject

type TestObject struct {
	Name      string
	Namespace string
	Kind      string
}

TestObject describes options for Infrastructure Template

type TestServiceAccountOption

type TestServiceAccountOption struct {
	Name      string
	Namespace string
}

TestServiceAccountOption describe options for ServiceAccount

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL