util

package
v1.8.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// CharSet defines the alphanumeric set for random string generation.
	CharSet = "0123456789abcdefghijklmnopqrstuvwxyz"
)

Variables

View Source
var (
	// CustomizedADCLabels defines a common selector used for testing
	CustomizedADCLabels = map[string]string{"test": "true"}
)
View Source
var DefaultAkoDeploymentConfigCommonSpec = akoov1alpha1.AKODeploymentConfigSpec{
	DataNetwork: akoov1alpha1.DataNetwork{
		Name: "integration-test-8ed12g",
		CIDR: "10.0.0.0/24",
		IPPools: []akoov1alpha1.IPPool{
			{
				Start: "10.0.0.1",
				End:   "10.0.0.10",
				Type:  "V4",
			},
		},
	},
	ControlPlaneNetwork: akoov1alpha1.ControlPlaneNetwork{
		Name: "integration-test-8ed12g",
		CIDR: "10.1.0.0/24",
	},
	ServiceEngineGroup: "ha-test",
	AdminCredentialRef: &akoov1alpha1.SecretRef{
		Name:      "controller-credentials",
		Namespace: "default",
	},
	CertificateAuthorityRef: &akoov1alpha1.SecretRef{
		Name:      "controller-ca",
		Namespace: "default",
	},
}
View Source
var DefaultCluster = clusterv1.Cluster{
	ObjectMeta: metav1.ObjectMeta{
		Name:      "integration-test",
		Namespace: "default",
	},
	Spec: clusterv1.ClusterSpec{},
}

Functions

func CreateObjects

func CreateObjects(ctx *builder.IntegrationTestContext, objs ...client.Object)

func DeleteObjects

func DeleteObjects(ctx *builder.IntegrationTestContext, objs ...client.Object)

func EnsureClusterAviLabelExists

func EnsureClusterAviLabelExists(ctx *builder.IntegrationTestContext, key client.ObjectKey, label string, exists bool)

func EnsureClusterAviLabelMatchExpectation

func EnsureClusterAviLabelMatchExpectation(ctx *builder.IntegrationTestContext, key client.ObjectKey, label, expectVal string)

func EnsureRuntimeObjectMatchExpectation

func EnsureRuntimeObjectMatchExpectation(ctx *builder.IntegrationTestContext, objKey client.ObjectKey, obj client.Object, expectResult ExpectResult)

func FindModuleDir

func FindModuleDir(module string) string

FindModuleDir returns the on-disk directory for the provided Go module.

func GetCustomizedADC

func GetCustomizedADC(labels map[string]string) *akoov1alpha1.AKODeploymentConfig

GetCustomizedADC returns a pointer to a customized ADC for testing with specified cluster selector labels

func GetDefaultADC

func GetDefaultADC() *akoov1alpha1.AKODeploymentConfig

GetDefaultADC returns a pointer to install-ako-for-all ADC for testing it has empty cluster selector to match all clusters

func GetDefaultCluster

func GetDefaultCluster() *clusterv1.Cluster

func GetManagementADC

func GetManagementADC() *akoov1alpha1.AKODeploymentConfig

GetManagementADC returns a pointer to install-ako-for-management-cluster ADC for testing it always selects cluster labelled as {"cluster-role.tkg.tanzu.vmware.com/management": ""}

func GetManagementCluster

func GetManagementCluster() *clusterv1.Cluster

func RandomString

func RandomString(n int) string

RandomString returns a random alphanumeric string.

func UpdateObjectLabels

func UpdateObjectLabels(ctx *builder.IntegrationTestContext, key client.ObjectKey, labels map[string]string)

func UpdateObjectsStatus

func UpdateObjectsStatus(ctx *builder.IntegrationTestContext, objs ...client.Object)

Types

type ExpectResult

type ExpectResult int
const (
	EXIST    ExpectResult = 0
	NOTFOUND ExpectResult = 1
	ERROR    ExpectResult = 2
)

Jump to

Keyboard shortcuts

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