testing

package
v0.5.3-beta.8 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: AGPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterName        = "fake-cluster-name"
	Namespace          = "fake-namespace"
	ClusterVersionName = "fake-cluster-version"
	ClusterDefName     = "fake-cluster-definition"
	ComponentName      = "fake-component-name"
	ComponentDefName   = "fake-component-type"
	NodeName           = "fake-node-name"
	SecretName         = "fake-secret-conn-credential"
	StorageClassName   = "fake-storage-class"
	PVCName            = "fake-pvc"

	KubeBlocksRepoName  = "fake-kubeblocks-repo"
	KubeBlocksChartName = "fake-kubeblocks"
	KubeBlocksChartURL  = "fake-kubeblocks-chart-url"
	BackupToolName      = "fake-backup-tool"

	IsDefautl    = true
	IsNotDefault = false
)

Variables

View Source
var (
	ExtraComponentDefName = fmt.Sprintf("%s-%d", ComponentDefName, 1)
)

Functions

func Capture

func Capture() func() (string, error)

Capture replaces os.Stdout with a writer that buffers any data written to os.Stdout. Call the returned function to cleanup and get the data as a string.

func ContainExpectStrings

func ContainExpectStrings(out string, expectStrings ...string) bool

ContainExpectStrings checks if the specific string contains the expected strings.

func FakeAddon

func FakeAddon(name string) *extensionsv1alpha1.Addon

func FakeBackup

func FakeBackup(backupName string) *dpv1alpha1.Backup

func FakeBackupPolicy

func FakeBackupPolicy(backupPolicyName, clusterName string) *dpv1alpha1.BackupPolicy

func FakeBackupTool

func FakeBackupTool() *dpv1alpha1.BackupTool

func FakeClientSet

func FakeClientSet(objects ...runtime.Object) *kubefakeclient.Clientset

func FakeCluster

func FakeCluster(name, namespace string, conditions ...metav1.Condition) *appsv1alpha1.Cluster

func FakeClusterDef

func FakeClusterDef() *appsv1alpha1.ClusterDefinition

func FakeClusterRole

func FakeClusterRole(name string) *rbacv1.ClusterRole

func FakeClusterRoleBinding

func FakeClusterRoleBinding(name string, sa *corev1.ServiceAccount, clusterRole *rbacv1.ClusterRole) *rbacv1.ClusterRoleBinding

func FakeClusterVersion

func FakeClusterVersion() *appsv1alpha1.ClusterVersion

func FakeComponentClassDef

func FakeComponentClassDef(name string, clusterDefRef string, componentDefRef string) *appsv1alpha1.ComponentClassDefinition

func FakeConfigConstraint

func FakeConfigConstraint(ccName string) *appsv1alpha1.ConfigConstraint

func FakeConfigMap

func FakeConfigMap(cmName string) *corev1.ConfigMap

func FakeCronJob

func FakeCronJob(name string, namespace string, extraLabels map[string]string) *batchv1.CronJob

func FakeDeploy

func FakeDeploy(name string, namespace string, extraLabels map[string]string) *appsv1.Deployment

func FakeDynamicClient

func FakeDynamicClient(objects ...runtime.Object) *dynamicfakeclient.FakeDynamicClient

func FakeEvents

func FakeEvents() *corev1.EventList

func FakeJob

func FakeJob(name string, namespace string, extraLabels map[string]string) *batchv1.Job

func FakeKBDeploy

func FakeKBDeploy(version string) *appsv1.Deployment

func FakeMetricsClientSet

func FakeMetricsClientSet(objects ...runtime.Object) *metricsfakeclient.Clientset

func FakeNode

func FakeNode() *corev1.Node

func FakePodForSts

func FakePodForSts(sts *appsv1.StatefulSet) *corev1.PodList

func FakePods

func FakePods(replicas int, namespace string, cluster string) *corev1.PodList

func FakeRole

func FakeRole(name string) *rbacv1.Role

func FakeRoleBinding

func FakeRoleBinding(name string, sa *corev1.ServiceAccount, role *rbacv1.Role) *rbacv1.RoleBinding

func FakeSecrets

func FakeSecrets(namespace string, cluster string) *corev1.SecretList

func FakeSecretsWithLabels

func FakeSecretsWithLabels(namespace string, labels map[string]string) *corev1.SecretList

func FakeServiceAccount

func FakeServiceAccount(name string) *corev1.ServiceAccount

func FakeServices

func FakeServices() *corev1.ServiceList

func FakeStatefulSet

func FakeStatefulSet(name string, namespace string, extraLabels map[string]string) *appsv1.StatefulSet

func FakeStorageClass

func FakeStorageClass(name string, isDefault bool) *storagev1.StorageClass

func FakeVolumeSnapshotClass

func FakeVolumeSnapshotClass() *snapshotv1.VolumeSnapshotClass

func GetRandomStr

func GetRandomStr() string

func NewTestFactory

func NewTestFactory(namespace string) *cmdtesting.TestFactory

NewTestFactory like cmdtesting.NewTestFactory, register KubeBlocks custom objects

Types

This section is empty.

Jump to

Keyboard shortcuts

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