diff --git a/tests/e2e/backup_restore_suite_test.go b/tests/e2e/backup_restore_suite_test.go index a262eeb164..87633e78f9 100644 --- a/tests/e2e/backup_restore_suite_test.go +++ b/tests/e2e/backup_restore_suite_test.go @@ -68,6 +68,8 @@ func prepareBackupAndRestore(brCase BackupRestoreCase, updateLastInstallTime fun gomega.Eventually(lib.AreNodeAgentPodsRunning(kubernetesClientForSuiteRun, namespace), time.Minute*3, time.Second*5).Should(gomega.BeTrue()) } + // Velero does not change status of VSL objects. Users can only confirm if VSLs are correct configured when running a native snapshot backup/restore + log.Print("Checking if BSL is available") gomega.Eventually(dpaCR.BSLsAreAvailable(), time.Minute*3, time.Second*5).Should(gomega.BeTrue()) @@ -409,5 +411,27 @@ var _ = ginkgo.Describe("Backup and restore tests", func() { BackupTimeout: 20 * time.Minute, }, }, nil), + ginkgo.Entry("MySQL application Native-Snapshots", ginkgo.FlakeAttempts(flakeAttempts), ginkgo.Label("aws", "azure", "gcp"), ApplicationBackupRestoreCase{ + ApplicationTemplate: "./sample-applications/mysql-persistent/mysql-persistent.yaml", + BackupRestoreCase: BackupRestoreCase{ + Namespace: "mysql-persistent", + Name: "mysql-native-snapshots-e2e", + BackupRestoreType: lib.NativeSnapshots, + PreBackupVerify: todoListReady(true, false, "mysql"), + PostRestoreVerify: todoListReady(false, false, "mysql"), + BackupTimeout: 20 * time.Minute, + }, + }, nil), + ginkgo.Entry("Mongo application Native-Snapshots", ginkgo.FlakeAttempts(flakeAttempts), ginkgo.Label("aws", "azure", "gcp"), ApplicationBackupRestoreCase{ + ApplicationTemplate: "./sample-applications/mongo-persistent/mongo-persistent.yaml", + BackupRestoreCase: BackupRestoreCase{ + Namespace: "mongo-persistent", + Name: "mongo-native-snapshots-e2e", + BackupRestoreType: lib.NativeSnapshots, + PreBackupVerify: todoListReady(true, false, "mongo"), + PostRestoreVerify: todoListReady(false, false, "mongo"), + BackupTimeout: 20 * time.Minute, + }, + }, nil), ) }) diff --git a/tests/e2e/dpa_deployment_suite_test.go b/tests/e2e/dpa_deployment_suite_test.go index c797188bb4..3dfc5ccd2a 100644 --- a/tests/e2e/dpa_deployment_suite_test.go +++ b/tests/e2e/dpa_deployment_suite_test.go @@ -198,7 +198,7 @@ var _ = ginkgo.Describe("Configuration testing for DPA Custom Resource", func() } if len(installCase.DpaSpec.SnapshotLocations) > 0 { - // TODO Check if VSLs are available creating new backup/restore test with VSL + // Velero does not change status of VSL objects. Users can only confirm if VSLs are correct configured when running a native snapshot backup/restore for _, vsl := range installCase.DpaSpec.SnapshotLocations { log.Printf("Checking for VSL spec") gomega.Expect(dpaCR.DoesVSLSpecMatchesDpa(namespace, *vsl.Velero)).To(gomega.BeTrue()) diff --git a/tests/e2e/e2e_suite_test.go b/tests/e2e/e2e_suite_test.go index fa94230c52..0fdf0907ac 100644 --- a/tests/e2e/e2e_suite_test.go +++ b/tests/e2e/e2e_suite_test.go @@ -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, diff --git a/tests/e2e/lib/dpa_helpers.go b/tests/e2e/lib/dpa_helpers.go index eddb89b376..3fdef85763 100644 --- a/tests/e2e/lib/dpa_helpers.go +++ b/tests/e2e/lib/dpa_helpers.go @@ -24,16 +24,18 @@ import ( type BackupRestoreType string const ( - CSI BackupRestoreType = "csi" - CSIDataMover BackupRestoreType = "csi-datamover" - RESTIC BackupRestoreType = "restic" - KOPIA BackupRestoreType = "kopia" + CSI BackupRestoreType = "csi" + CSIDataMover BackupRestoreType = "csi-datamover" + RESTIC BackupRestoreType = "restic" + KOPIA BackupRestoreType = "kopia" + NativeSnapshots BackupRestoreType = "native-snapshots" ) type DpaCustomResource struct { Name string Namespace string Client client.Client + VSLSecretName string BSLSecretName string BSLConfig map[string]string BSLProvider string @@ -112,6 +114,13 @@ 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 NativeSnapshots: + dpaSpec.SnapshotLocations[0].Velero.Credential = &corev1.SecretKeySelector{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: v.VSLSecretName, + }, + Key: "cloud", + } } return &dpaSpec