testing

package
v1.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: AGPL-3.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterName      = "fake-cluster-name"
	Namespace        = "fake-namespace"
	ClusterDefName   = "fake-cluster-definition"
	ClusterType      = "fake-cluster-Type"
	CompDefName      = "fake-component-definition"
	ComponentName    = "fake-component-name"
	NodeName         = "fake-node-name"
	SecretName       = "fake-secret-conn-credential"
	StorageClassName = "fake-storage-class"
	PVCName          = "fake-pvc"
	BPTName          = "fake-bpt"
	RestoreName      = "fake-restore"

	KubeBlocksRepoName  = "fake-kubeblocks-repo"
	KubeBlocksChartName = "fake-kubeblocks"
	KubeBlocksChartURL  = "fake-kubeblocks-chart-url"
	BackupMethodName    = "fake-backup-method"
	ActionSetName       = "fake-action-set"
	BackupName          = "fake-backup-name"

	IsDefault = true
)

Variables

This section is empty.

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 clean up and return 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 FakeActionSet

func FakeActionSet() *dpv1alpha1.ActionSet

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 FakeBackupPolicyTemplate

func FakeBackupPolicyTemplate() *dpv1alpha1.BackupPolicyTemplate

func FakeBackupRepo

func FakeBackupRepo(name string, isDefault bool) *dpv1alpha1.BackupRepo

func FakeBackupSchedule

func FakeBackupSchedule(backupScheduleName, backupPolicyName string) *dpv1alpha1.BackupSchedule

func FakeBackupWithCluster

func FakeBackupWithCluster(cluster *kbappsv1.Cluster, backupName string) *dpv1alpha1.Backup

func FakeClientSet

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

func FakeCluster

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

func FakeClusterDef

func FakeClusterDef() *kbappsv1.ClusterDefinition

func FakeClusterList

func FakeClusterList() *kbappsv1.ClusterList

func FakeClusterRole

func FakeClusterRole(name string) *rbacv1.ClusterRole

func FakeClusterRoleBinding

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

func FakeCompDef added in v0.7.2

func FakeCompDef() *kbappsv1.ComponentDefinition

func FakeConfigConstraint

func FakeConfigConstraint(ccName string) *appsv1beta1.ConfigConstraint

func FakeConfigMap

func FakeConfigMap(cmName string, namespace string, data map[string]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 FakeEventForObject

func FakeEventForObject(name string, namespace string, object string) *corev1.Event

func FakeEvents

func FakeEvents() *corev1.EventList

func FakeJob

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

func FakeKBClientSet

func FakeKBClientSet(objects ...runtime.Object) *kbfakeclient.Clientset

func FakeKBDeploy

func FakeKBDeploy(version string) *appsv1.Deployment

func FakeMetricsClientSet

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

func FakeNode

func FakeNode() *corev1.Node

func FakePodChaos

func FakePodChaos(name, namespace string) *chaosmeshv1alpha1.PodChaos

func FakePodForSts

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

func FakePods

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

func FakeResourceNotFound

func FakeResourceNotFound(versionResource schema.GroupVersionResource, name string) *metav1.Status

func FakeRestore

func FakeRestore(backupName string) *dpv1alpha1.Restore

func FakeRole

func FakeRole(name string) *rbacv1.Role

func FakeRoleBinding

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

func FakeSecret

func FakeSecret(namespace string, cluster string) *corev1.Secret

FakeSecret for test cluster create

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 FakeServiceRef

func FakeServiceRef(serviceRefName string) appsv1alpha1.ServiceRefDeclaration

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 FakeStorageProvider

func FakeStorageProvider(name string, mutateFunc func(obj *dpv1alpha1.StorageProvider)) *dpv1alpha1.StorageProvider

func FakeVolumeSnapshotClass

func FakeVolumeSnapshotClass() *snapshotv1.VolumeSnapshotClass

func GetRandomStr

func GetRandomStr() string

func NewTestFactory

func NewTestFactory(namespace string) *cmdtesting.TestFactory

NewTestFactory is like cmdtesting.NewTestFactory, registers 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