Skip to content

Commit

Permalink
PB-7692 & PB-7802: Add wrapper func and update existing tests to run …
Browse files Browse the repository at this point in the history
…with Azure (#2732)
  • Loading branch information
kshithijiyer-px authored Aug 20, 2024
1 parent e63a5bc commit f074a05
Show file tree
Hide file tree
Showing 21 changed files with 363 additions and 168 deletions.
7 changes: 5 additions & 2 deletions tests/backup/backup_basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ func getGlobalBucketName(provider string) string {
}

func getGlobalLockedBucketName(provider string) string {
if provider == drivers.ProviderAws {
switch provider {
case drivers.ProviderAws:
return GlobalAWSLockedBucketName
} else {
case drivers.ProviderAzure:
return GlobalAzureLockedBucketName
default:
log.Errorf("environment variable [%s] not provided with valid values", "PROVIDERS")
return ""
}
Expand Down
2 changes: 1 addition & 1 deletion tests/backup/backup_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ var _ = Describe("{DeleteBucketVerifyCloudBackupMissing}", Label(TestCaseLabelsM
err = DestroyAppsWithData(scheduledAppContexts, opts, controlChannel, errorGroup)
log.FailOnError(err, "Data validations failed")
for _, scheduleName := range scheduleNames {
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Verification of deleting backup schedule - %s", scheduleName))
}
log.Infof("Deleting backup schedule policy")
Expand Down
2 changes: 1 addition & 1 deletion tests/backup/backup_dr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ var _ = Describe("{BackupAndRestoreSyncDR}", Label(TestCaseLabelsMap[BackupAndRe
dash.VerifySafely(err, nil, fmt.Sprintf("Deleting restore [%s]", restoreName))
}
for _, scheduleName := range scheduleNames {
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Deleting schedule [%s]", scheduleName))
}
for migrationName, migrationNamespace := range migrationNamespaceMap {
Expand Down
4 changes: 2 additions & 2 deletions tests/backup/backup_kdmp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ var _ = Describe("{ExcludeDirectoryFileBackup}", Label(TestCaseLabelsMap[Exclude
}

for _, scheduleName := range scheduleNames {
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Deleting schedule [%s]", scheduleName))
}

Expand Down Expand Up @@ -1392,7 +1392,7 @@ var _ = Describe("{ExcludeInvalidDirectoryFileBackup}", Label(TestCaseLabelsMap[
}

for _, scheduleName := range scheduleNames {
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Deleting schedule [%s]", scheduleName))
}

Expand Down
6 changes: 3 additions & 3 deletions tests/backup/backup_kubevirt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2506,7 +2506,7 @@ var _ = Describe("{DefaultBackupRestoreWithKubevirtAndNonKubevirtNS}", Label(Tes
go func(scheduleName string) {
defer GinkgoRecover()
defer wg.Done()
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Deleting backup schedules [%s]", scheduleName))
if err != nil {
mutex.Lock()
Expand Down Expand Up @@ -2811,7 +2811,7 @@ var _ = Describe("{KubevirtScheduledVMDelete}", Label(TestCaseLabelsMap[Kubevirt
opts := make(map[string]bool)
opts[SkipClusterScopedObjects] = true
for _, scheduleName := range scheduleNames {
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Verification of deleting backup schedule - %s", scheduleName))
}
log.Infof("Deleting backup schedule policy")
Expand Down Expand Up @@ -3254,7 +3254,7 @@ var _ = Describe("{CustomBackupRestoreWithKubevirtAndNonKubevirtNS}", Label(Test
go func(scheduleName string) {
defer GinkgoRecover()
defer wg.Done()
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Deleting backup schedules [%s]", scheduleName))
if err != nil {
mutex.Lock()
Expand Down
263 changes: 182 additions & 81 deletions tests/backup/backup_locked_bucket_test.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/backup/backup_multiple_provisioner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ var _ = Describe("{MultipleProvisionerCsiKdmpBackupAndRestore}", Label(TestCaseL
ctx, err := backup.GetAdminCtxFromSecret()
log.FailOnError(err, "Fetching px-central-admin ctx")
for _, scheduleName := range scheduleNames {
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Verification of deleting backup schedule - %s", scheduleName))
}

Expand Down
10 changes: 5 additions & 5 deletions tests/backup/backup_namespace_labelled_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ var _ = Describe("{BackupScheduleForOldAndNewNS}", Label(TestCaseLabelsMap[Backu
defer EndPxBackupTorpedoTest(contexts)
ctx, err := backup.GetAdminCtxFromSecret()
dash.VerifySafely(err, nil, "Fetching px-central-admin ctx")
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Verification of deleting backup schedule - %s", scheduleName))
err = Inst().Backup.DeleteBackupSchedulePolicy(BackupOrgID, []string{periodicSchPolicyName})
dash.VerifySafely(err, nil, fmt.Sprintf("Deleting backup schedule policies %s ", []string{periodicSchPolicyName}))
Expand Down Expand Up @@ -616,7 +616,7 @@ var _ = Describe("{ManualAndScheduledBackupUsingNamespaceAndResourceLabel}", Lab
defer EndPxBackupTorpedoTest(scheduledAppContexts)
ctx, err := backup.GetAdminCtxFromSecret()
log.FailOnError(err, "Unable to fetch px-central-admin ctx")
err = DeleteSchedule(scheduleBackupName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleBackupName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Verification of deleting backup schedule - %s", scheduleBackupName))
err = Inst().Backup.DeleteBackupSchedulePolicy(BackupOrgID, []string{periodicSchPolicyName})
dash.VerifySafely(err, nil, fmt.Sprintf("Deleting backup schedule policies %s ", []string{periodicSchPolicyName}))
Expand Down Expand Up @@ -848,7 +848,7 @@ var _ = Describe("{ScheduleBackupWithAdditionAndRemovalOfNS}", Label(TestCaseLab
defer EndPxBackupTorpedoTest(scheduledAppContexts)
ctx, err := backup.GetAdminCtxFromSecret()
log.FailOnError(err, "Fetching px-central-admin ctx")
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Verification of deleting backup schedule - %s", scheduleName))
time.Sleep(1 * time.Minute)
err = Inst().Backup.DeleteBackupSchedulePolicy(BackupOrgID, []string{periodicSchPolicyName})
Expand Down Expand Up @@ -1216,7 +1216,7 @@ var _ = Describe("{ManualAndScheduleBackupUsingNSLabelWithMaxCharLimit}", Label(
ctx, err := backup.GetAdminCtxFromSecret()
log.FailOnError(err, "Fetching px-central-admin ctx")
for _, scheduleName := range scheduleNames {
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Verification of deleting backup schedule - %s", scheduleName))
}
err = Inst().Backup.DeleteBackupSchedulePolicy(BackupOrgID, []string{periodicSchPolicyName})
Expand Down Expand Up @@ -1417,7 +1417,7 @@ var _ = Describe("{NamespaceLabelledBackupOfEmptyNamespace}", Label(TestCaseLabe
log.InfoD("Deleting the restores taken")
err = DeleteRestore(restoreWithNamespaces, BackupOrgID, ctx)
dash.VerifySafely(err, nil, fmt.Sprintf("Deleting restore %s", restoreWithNamespaces))
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Verification of deleting backup schedule - %s", scheduleName))
err = Inst().Backup.DeleteBackupSchedulePolicy(BackupOrgID, []string{periodicSchedulePolicyName})
dash.VerifySafely(err, nil, fmt.Sprintf("Deleting backup schedule policies %s ", []string{periodicSchedulePolicyName}))
Expand Down
4 changes: 2 additions & 2 deletions tests/backup/backup_nfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ var _ = Describe("{DeleteNfsExecutorPodWhileBackupAndRestoreInProgress}", Label(
err = DeleteRestore(restoreName, BackupOrgID, ctx)
dash.VerifySafely(err, nil, fmt.Sprintf("Deleting restore %s", restoreName))
}
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Verification of deleting backup schedule - %s", scheduleName))
err = Inst().Backup.DeleteBackupSchedulePolicy(BackupOrgID, []string{schedulePolicyName})
dash.VerifySafely(err, nil, fmt.Sprintf("Deleting backup schedule policies %s ", []string{schedulePolicyName}))
Expand Down Expand Up @@ -664,7 +664,7 @@ var _ = Describe("{CloudSnapshotMissingValidationForNFSLocation}", Label(TestCas
go func(schedule string) {
defer GinkgoRecover()
defer wg.Done()
err = DeleteSchedule(schedule, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(schedule, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Deleting Backup Schedule [%s]", schedule))
}(schedule)
}
Expand Down
8 changes: 4 additions & 4 deletions tests/backup/backup_partial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ var _ = Describe("{BackupCSIVolumesWithPartialSuccess}", Label(TestCaseLabelsMap
log.FailOnError(err, "Fetching px-central-admin ctx")

for _, scheduleName := range scheduleNames {
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Verification of deleting backup schedule - %s", scheduleName))
}

Expand Down Expand Up @@ -712,7 +712,7 @@ var _ = Describe("{PartialBackupSuccessWithPxAndKDMPVolumes}", Label(TestCaseLab
ctx, err := backup.GetAdminCtxFromSecret()
log.FailOnError(err, "Fetching px-central-admin ctx")
for _, scheduleName := range scheduleNames {
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Verification of deleting backup schedule - %s", scheduleName))
}
err = Inst().Backup.DeleteBackupSchedulePolicy(BackupOrgID, []string{schedulePolicyName})
Expand Down Expand Up @@ -966,7 +966,7 @@ var _ = Describe("{BackupStateTransitionForScheduledBackups}", Label(TestCaseLab
DestroyApps(scheduledAppContexts, opts)
log.InfoD("Deleting all the backup schedules")
for _, schBkpName := range scheduledNames {
err = DeleteSchedule(schBkpName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(schBkpName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Verifying deletion of backup schedule [%s]", schBkpName))
}
log.InfoD("Deleting all the backups")
Expand Down Expand Up @@ -1199,7 +1199,7 @@ var _ = Describe("{PartialBackupWithLowerStorkVersion}", Label(TestCaseLabelsMap
ctx, err := backup.GetAdminCtxFromSecret()
log.FailOnError(err, "Fetching px-central-admin ctx")
for _, scheduleName := range scheduleNames {
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Verification of deleting backup schedule - %s", scheduleName))
}
// Cleanup all backups
Expand Down
2 changes: 1 addition & 1 deletion tests/backup/backup_portworx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ var _ = Describe("{ResizeVolumeOnScheduleBackup}", Label(TestCaseLabelsMap[Resiz
ctx, err := backup.GetAdminCtxFromSecret()
dash.VerifySafely(err, nil, "Fetching px-central-admin ctx")
for i := 0; i < len(scheduleNames); i++ {
err = DeleteSchedule(scheduleNames[i], SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleNames[i], SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Verifying deletion of schedule named [%s] and schedule policies [%v]", scheduleNames[i], periodicSchedulePolicyNames[i]))
}
log.InfoD("Deleting created restores")
Expand Down
4 changes: 2 additions & 2 deletions tests/backup/backup_psa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,7 @@ var _ = Describe("{PsaTakeBackupInLowerPrivilegeRestoreInHigherPrivilege}", Labe

log.Info("Deleting schedules")
for _, scheduleName := range scheduleNames {
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Deleting schedule [%s]", scheduleName))
}
err = DeleteBackupSchedulePolicyWithContext(BackupOrgID, []string{periodicSchedulePolicyName}, ctx)
Expand Down Expand Up @@ -1971,7 +1971,7 @@ var _ = Describe("{PSALowerPrivilegeToHigherPrivilegeWithProjectMapping}", Label
DestroyApps(scheduledAppContexts, opts)
log.Info("Deleting schedules")
for _, scheduleName := range scheduleNames {
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx)
err = DeleteSchedule(scheduleName, SourceClusterName, BackupOrgID, ctx, true)
dash.VerifySafely(err, nil, fmt.Sprintf("Deleting schedule [%s]", scheduleName))
}
log.Infof("Deleting pre & post exec rules")
Expand Down
Loading

0 comments on commit f074a05

Please sign in to comment.