dataprotection

package
v1.0.0-beta.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ClusterName   = "test-cluster"
	ComponentName = "test-comp"
	ContainerName = "test-container"
	PortName      = "test-port"
	ProtocolName  = "TCP"
	PortNum       = 10000

	BackupName         = "test-backup"
	BackupRepoName     = "test-repo"
	BackupPolicyName   = "test-backup-policy"
	BackupMethodName   = "xtrabackup"
	VSBackupMethodName = "volume-snapshot"
	BackupPathPrefix   = "/backup"
	ActionSetName      = "xtrabackup"

	DataVolumeName      = "data"
	DataVolumeMountPath = "/data"
	LogVolumeName       = "log"
	LogVolumeMountPath  = "/log"

	StorageProviderName = "test-sp"
	StorageClassName    = "test-sc"

	BackupScheduleName      = "test-backup-schedule"
	BackupScheduleCron      = "0 3 * * *"
	BackupRetention         = "7d"
	StartingDeadlineMinutes = 10

	KBToolImage         = "apecloud/kubeblocks-tool:latest"
	BackupPVCName       = "test-backup-pvc"
	ImageTag            = "latest"
	BackupPolicyTPLName = "test-backup-policy-template-mysql"
)
View Source
const (
	RestoreName       = "test-restore"
	MysqlTemplateName = "data-mysql-mysql"
)

Restore

Variables

This section is empty.

Functions

func CheckRestoreAndSetCompleted

func CheckRestoreAndSetCompleted(testCtx *testutil.TestContext, clusterKey types.NamespacedName, compName string, scaleOutReplicas int)

func CreateBackupPolicyTpl

func CreateBackupPolicyTpl(testCtx *testutil.TestContext, compDef string) *dpv1alpha1.BackupPolicyTemplate

func EnableBackupSchedule

func EnableBackupSchedule(testCtx *testutil.TestContext,
	backupSchedule *dpv1alpha1.BackupSchedule, method string)

EnableBackupSchedule enables the backup schedule that matches the given method.

func MockBackupStatusMethod

func MockBackupStatusMethod(backup *dpv1alpha1.Backup, backupMethodName, targetVolume, actionSetName string)

func MockBackupStatusTarget added in v0.9.0

func MockBackupStatusTarget(backup *dpv1alpha1.Backup, podSelectionStrategy dpv1alpha1.PodSelectionStrategy)

func MockBackupVSStatusActions added in v0.9.0

func MockBackupVSStatusActions(backup *dpv1alpha1.Backup)

func MockRestoreCompleted

func MockRestoreCompleted(testCtx *testutil.TestContext, ml client.MatchingLabels)

func NewFakeActionSet

func NewFakeActionSet(testCtx *testutil.TestContext) *dpv1alpha1.ActionSet

func NewFakeBackup

func NewFakeBackup(testCtx *testutil.TestContext,
	change func(backup *dpv1alpha1.Backup)) *dpv1alpha1.Backup

func NewFakeBackupPolicy

func NewFakeBackupPolicy(testCtx *testutil.TestContext,
	change func(backupPolicy *dpv1alpha1.BackupPolicy),
	doNotExpectAvailable ...bool) *dpv1alpha1.BackupPolicy

func NewFakeBackupRepo

func NewFakeBackupRepo(testCtx *testutil.TestContext,
	change func(repo *dpv1alpha1.BackupRepo)) (*dpv1alpha1.BackupRepo, string)

func NewFakeBackupSchedule

func NewFakeBackupSchedule(testCtx *testutil.TestContext,
	change func(schedule *dpv1alpha1.BackupSchedule)) *dpv1alpha1.BackupSchedule

func NewFakePVC

func NewFakePVC(testCtx *testutil.TestContext, name string) *corev1.PersistentVolumeClaim

func NewFakeStorageProvider

func NewFakeStorageProvider(testCtx *testutil.TestContext,
	change func(sp *dpv1alpha1.StorageProvider)) *dpv1alpha1.StorageProvider

func PatchBackupStatus

func PatchBackupStatus(testCtx *testutil.TestContext, key client.ObjectKey, status dpv1alpha1.BackupStatus)

func PatchK8sJobStatus

func PatchK8sJobStatus(testCtx *testutil.TestContext, key client.ObjectKey, jobStatus batchv1.JobConditionType)

func PatchVolumeSnapshotStatus

func PatchVolumeSnapshotStatus(testCtx *testutil.TestContext, key client.ObjectKey, readyToUse bool)

func ReplaceK8sJobStatus

func ReplaceK8sJobStatus(testCtx *testutil.TestContext, key client.ObjectKey, jobStatus batchv1.JobConditionType)

Types

type BackupClusterInfo

type BackupClusterInfo struct {
	Cluster   *appsv1.Cluster
	TargetPod *corev1.Pod
	TargetPVC string
}

func NewFakeCluster

func NewFakeCluster(testCtx *testutil.TestContext) *BackupClusterInfo

type BackupScheduleFactory

func NewBackupScheduleFactory

func NewBackupScheduleFactory(namespace, name string) *BackupScheduleFactory

func (*BackupScheduleFactory) AddSchedulePolicy

func (f *BackupScheduleFactory) AddSchedulePolicy(schedulePolicy dpv1alpha1.SchedulePolicy) *BackupScheduleFactory

func (*BackupScheduleFactory) SetBackupPolicyName

func (f *BackupScheduleFactory) SetBackupPolicyName(backupPolicyName string) *BackupScheduleFactory

func (*BackupScheduleFactory) SetSchedules

func (*BackupScheduleFactory) SetStartingDeadlineMinutes

func (f *BackupScheduleFactory) SetStartingDeadlineMinutes(minutes int64) *BackupScheduleFactory

type MockBackupFactory

type MockBackupFactory struct {
	testapps.BaseFactory[dpv1alpha1.Backup, *dpv1alpha1.Backup, MockBackupFactory]
}

func NewBackupFactory

func NewBackupFactory(namespace, name string) *MockBackupFactory

func (*MockBackupFactory) SetBackupMethod

func (f *MockBackupFactory) SetBackupMethod(backupMethod string) *MockBackupFactory

func (*MockBackupFactory) SetBackupPolicyName

func (f *MockBackupFactory) SetBackupPolicyName(backupPolicyName string) *MockBackupFactory

func (*MockBackupFactory) SetBackupTimeRange

func (f *MockBackupFactory) SetBackupTimeRange(startTime, stopTime time.Time) *MockBackupFactory

func (*MockBackupFactory) SetLabels

func (f *MockBackupFactory) SetLabels(labels map[string]string) *MockBackupFactory

type MockBackupPolicyFactory

func NewBackupPolicyFactory

func NewBackupPolicyFactory(namespace, name string) *MockBackupPolicyFactory

func (*MockBackupPolicyFactory) AddBackupMethod

func (f *MockBackupPolicyFactory) AddBackupMethod(name string,
	snapshotVolumes bool, actionSetName string) *MockBackupPolicyFactory

func (*MockBackupPolicyFactory) SetBackoffLimit

func (f *MockBackupPolicyFactory) SetBackoffLimit(backoffLimit int32) *MockBackupPolicyFactory

func (*MockBackupPolicyFactory) SetBackupMethodVolumeMounts

func (f *MockBackupPolicyFactory) SetBackupMethodVolumeMounts(keyAndValues ...string) *MockBackupPolicyFactory

func (*MockBackupPolicyFactory) SetBackupMethodVolumes

func (f *MockBackupPolicyFactory) SetBackupMethodVolumes(names []string) *MockBackupPolicyFactory

func (*MockBackupPolicyFactory) SetBackupRepoName

func (f *MockBackupPolicyFactory) SetBackupRepoName(backupRepoName string) *MockBackupPolicyFactory

func (*MockBackupPolicyFactory) SetPathPrefix

func (f *MockBackupPolicyFactory) SetPathPrefix(pathPrefix string) *MockBackupPolicyFactory

func (*MockBackupPolicyFactory) SetTarget

func (f *MockBackupPolicyFactory) SetTarget(keyAndValues ...string) *MockBackupPolicyFactory

func (*MockBackupPolicyFactory) SetTargetConnectionCredential

func (f *MockBackupPolicyFactory) SetTargetConnectionCredential(secretName string) *MockBackupPolicyFactory

type MockBackupPolicyTemplateFactory

func NewBackupPolicyTemplateFactory

func NewBackupPolicyTemplateFactory(name string) *MockBackupPolicyTemplateFactory

func (*MockBackupPolicyTemplateFactory) AddBackupMethod

func (f *MockBackupPolicyTemplateFactory) AddBackupMethod(name string, snapshotVolumes bool, actionSetName string) *MockBackupPolicyTemplateFactory

func (*MockBackupPolicyTemplateFactory) AddSchedule

func (f *MockBackupPolicyTemplateFactory) AddSchedule(method, schedule, retentionPeriod string, enable bool) *MockBackupPolicyTemplateFactory

func (*MockBackupPolicyTemplateFactory) SetBackupMethodVolumeMounts

func (f *MockBackupPolicyTemplateFactory) SetBackupMethodVolumeMounts(keyAndValues ...string) *MockBackupPolicyTemplateFactory

func (*MockBackupPolicyTemplateFactory) SetBackupMethodVolumes

func (f *MockBackupPolicyTemplateFactory) SetBackupMethodVolumes(names []string) *MockBackupPolicyTemplateFactory

func (*MockBackupPolicyTemplateFactory) SetCompDefs

func (*MockBackupPolicyTemplateFactory) SetLabels

func (*MockBackupPolicyTemplateFactory) SetTargetRole

type MockBackupRepoFactory

func NewBackupRepoFactory

func NewBackupRepoFactory(namespace, name string) *MockBackupRepoFactory

func (*MockBackupRepoFactory) SetAsDefaultRepo

func (factory *MockBackupRepoFactory) SetAsDefaultRepo(v bool) *MockBackupRepoFactory

func (*MockBackupRepoFactory) SetConfig

func (factory *MockBackupRepoFactory) SetConfig(config map[string]string) *MockBackupRepoFactory

func (*MockBackupRepoFactory) SetCredential

func (factory *MockBackupRepoFactory) SetCredential(ref *corev1.SecretReference) *MockBackupRepoFactory

func (*MockBackupRepoFactory) SetPVReclaimPolicy

func (factory *MockBackupRepoFactory) SetPVReclaimPolicy(policy string) *MockBackupRepoFactory

func (*MockBackupRepoFactory) SetStorageProviderRef

func (factory *MockBackupRepoFactory) SetStorageProviderRef(providerName string) *MockBackupRepoFactory

func (*MockBackupRepoFactory) SetVolumeCapacity

func (factory *MockBackupRepoFactory) SetVolumeCapacity(amount string) *MockBackupRepoFactory

type MockRestoreFactory

func NewRestoreFactory added in v0.7.1

func NewRestoreFactory(namespace, name string) *MockRestoreFactory

func (*MockRestoreFactory) AddEnv

func (*MockRestoreFactory) AddVolumeClaim

func (f *MockRestoreFactory) AddVolumeClaim(claimName, volumeSource, mountPath, storageClass string) *MockRestoreFactory

func (*MockRestoreFactory) SetBackup

func (f *MockRestoreFactory) SetBackup(name, namespace string) *MockRestoreFactory

func (*MockRestoreFactory) SetConnectCredential

func (f *MockRestoreFactory) SetConnectCredential(secretName string) *MockRestoreFactory

func (*MockRestoreFactory) SetDataSourceRef

func (f *MockRestoreFactory) SetDataSourceRef(volumeSource, mountPath string) *MockRestoreFactory

func (*MockRestoreFactory) SetExecActionConfig

func (f *MockRestoreFactory) SetExecActionConfig(matchLabels map[string]string) *MockRestoreFactory

func (*MockRestoreFactory) SetJobActionConfig

func (f *MockRestoreFactory) SetJobActionConfig(matchLabels map[string]string) *MockRestoreFactory

func (*MockRestoreFactory) SetLabels

func (f *MockRestoreFactory) SetLabels(labels map[string]string) *MockRestoreFactory

func (*MockRestoreFactory) SetNamespace added in v0.9.0

func (f *MockRestoreFactory) SetNamespace(namespace string) *MockRestoreFactory

func (*MockRestoreFactory) SetPrepareDataRequiredPolicy added in v0.9.0

func (f *MockRestoreFactory) SetPrepareDataRequiredPolicy(restorePolicy dpv1alpha1.DataRestorePolicy, sourceTargetPodName string) *MockRestoreFactory

func (*MockRestoreFactory) SetRestoreTime

func (f *MockRestoreFactory) SetRestoreTime(restoreTime string) *MockRestoreFactory

func (*MockRestoreFactory) SetSchedulingSpec

func (f *MockRestoreFactory) SetSchedulingSpec(schedulingSpec dpv1alpha1.SchedulingSpec) *MockRestoreFactory

func (*MockRestoreFactory) SetVolumeClaimRestorePolicy

func (f *MockRestoreFactory) SetVolumeClaimRestorePolicy(policy dpv1alpha1.VolumeClaimRestorePolicy) *MockRestoreFactory

func (*MockRestoreFactory) SetVolumeClaimsTemplate

func (f *MockRestoreFactory) SetVolumeClaimsTemplate(templateName, volumeSource, mountPath, storageClass string, replicas, startingIndex int32, labels map[string]string) *MockRestoreFactory

type MockVolumeSnapshotFactory

type MockVolumeSnapshotFactory struct {
	testapps.BaseFactory[vsv1.VolumeSnapshot, *vsv1.VolumeSnapshot, MockVolumeSnapshotFactory]
}

func NewVolumeSnapshotFactory

func NewVolumeSnapshotFactory(namespace, name string) *MockVolumeSnapshotFactory

func (*MockVolumeSnapshotFactory) SetSourcePVCName

func (f *MockVolumeSnapshotFactory) SetSourcePVCName(name string) *MockVolumeSnapshotFactory

Jump to

Keyboard shortcuts

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