dataprotection

package
v0.7.2-beta.23 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterName   = "test-cluster"
	ComponentName = "test-comp"
	ContainerName = "test-container"

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

	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"
)
View Source
const (
	RestoreName       = "test-restore"
	MysqlTemplateName = "data-mysql-mysql"
)

Restore

Variables

This section is empty.

Functions

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