Skip to content

Commit

Permalink
fix issue openshift#1464: Added VSL Backup/Restore Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stillalearner committed Oct 10, 2024
1 parent c55320d commit 313b3d6
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/e2e/backup_restore_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,5 +409,27 @@ var _ = ginkgo.Describe("Backup and restore tests", func() {
BackupTimeout: 20 * time.Minute,
},
}, nil),
ginkgo.Entry("MySQL application VSL", ginkgo.FlakeAttempts(flakeAttempts), ApplicationBackupRestoreCase{
ApplicationTemplate: "./sample-applications/mysql-persistent/mysql-persistent.yaml",
BackupRestoreCase: BackupRestoreCase{
Namespace: "mysql-persistent",
Name: "mysql-vsl-e2e",
BackupRestoreType: lib.VSL,
PreBackupVerify: todoListReady(true, false, "mysql"),
PostRestoreVerify: todoListReady(false, false, "mysql"),
BackupTimeout: 20 * time.Minute,
},
}, nil),
ginkgo.Entry("Mongo application VSL", ginkgo.FlakeAttempts(flakeAttempts), ApplicationBackupRestoreCase{
ApplicationTemplate: "./sample-applications/mongo-persistent/mongo-persistent.yaml",
BackupRestoreCase: BackupRestoreCase{
Namespace: "mongo-persistent",
Name: "mongo-vsl-e2e",
BackupRestoreType: lib.VSL,
PreBackupVerify: todoListReady(true, false, "mongo"),
PostRestoreVerify: todoListReady(false, false, "mongo"),
BackupTimeout: 20 * time.Minute,
},
}, nil),
)
})
1 change: 1 addition & 0 deletions tests/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ func TestOADPE2E(t *testing.T) {
Name: "ts-" + instanceName,
Namespace: namespace,
Client: runTimeClientForSuiteRun,
VSLSecretName: vslSecretName,
BSLSecretName: bslSecretName,
BSLConfig: dpa.DeepCopy().Spec.BackupLocations[0].Velero.Config,
BSLProvider: dpa.DeepCopy().Spec.BackupLocations[0].Velero.Provider,
Expand Down
22 changes: 22 additions & 0 deletions tests/e2e/lib/dpa_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ const (
CSIDataMover BackupRestoreType = "csi-datamover"
RESTIC BackupRestoreType = "restic"
KOPIA BackupRestoreType = "kopia"
VSL BackupRestoreType = "vsl"
)

type DpaCustomResource struct {
Name string
Namespace string
Client client.Client
VSLSecretName string
BSLSecretName string
BSLConfig map[string]string
BSLProvider string
Expand Down Expand Up @@ -112,6 +114,26 @@ func (v *DpaCustomResource) Build(backupRestoreType BackupRestoreType) *oadpv1al
dpaSpec.Configuration.Velero.DefaultPlugins = append(dpaSpec.Configuration.Velero.DefaultPlugins, oadpv1alpha1.DefaultPluginCSI)
dpaSpec.Configuration.Velero.FeatureFlags = append(dpaSpec.Configuration.Velero.FeatureFlags, velero.CSIFeatureFlag)
dpaSpec.SnapshotLocations = nil
case VSL:
dpaSpec.SnapshotLocations = []oadpv1alpha1.SnapshotLocation{
{
Velero: &velero.VolumeSnapshotLocationSpec{
Provider: v.BSLProvider,
Credential: &corev1.SecretKeySelector{
LocalObjectReference: corev1.LocalObjectReference{
Name: v.VSLSecretName,
},
Key: "cloud",
},
},
},
}
if v.BSLProvider == "aws" {
dpaSpec.SnapshotLocations[0].Velero.Config = map[string]string{
"region": "us-east-1",
"profile": "default",
}
}
}

return &dpaSpec
Expand Down

0 comments on commit 313b3d6

Please sign in to comment.