testing

package
v0.8.2-beta.6 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: AGPL-3.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterName        = "fake-cluster-name"
	Namespace          = "fake-namespace"
	ClusterVersionName = "fake-cluster-version"
	ClusterDefName     = "fake-cluster-definition"
	CompDefName        = "fake-component-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"
	ServiceRefName     = "fake-serviceRef"

	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
	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 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(backupPolicyTemplateName string, clusterDef string) *appsv1alpha1.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 *appsv1alpha1.Cluster, backupName string) *dpv1alpha1.Backup

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 FakeClusterList

func FakeClusterList() *appsv1alpha1.ClusterList

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 FakeCompDef added in v0.7.2

func FakeCompDef() *appsv1alpha1.ComponentDefinition

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, 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 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 *storagev1alpha1.StorageProvider)) *storagev1alpha1.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