mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-10-01 12:15:36 +00:00
Skip uninstall and resource cleanup when fail-fast is enabled.
Signed-off-by: Xun Jiang <xun.jiang@broadcom.com>
This commit is contained in:
@@ -62,7 +62,9 @@ func backup_deletion_test(useVolumeSnapshots bool) {
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
if !veleroCfg.Debug {
|
||||
if CurrentSpecReport().Failed() && veleroCfg.FailFast {
|
||||
fmt.Println("Test case failed and fail fast is enabled. Skip resource clean up.")
|
||||
} else {
|
||||
By("Clean backups after test", func() {
|
||||
DeleteAllBackups(context.Background(), &veleroCfg)
|
||||
})
|
||||
@@ -104,13 +106,17 @@ func runBackupDeletionTests(client TestClient, veleroCfg VeleroConfig, backupLoc
|
||||
if err := CreateNamespace(oneHourTimeout, client, ns); err != nil {
|
||||
return errors.Wrapf(err, "Failed to create namespace %s to install Kibishii workload", ns)
|
||||
}
|
||||
if !veleroCfg.Debug {
|
||||
|
||||
if CurrentSpecReport().Failed() && veleroCfg.FailFast {
|
||||
fmt.Println("Test case failed and fail fast is enabled. Skip resource clean up.")
|
||||
} else {
|
||||
defer func() {
|
||||
if err := DeleteNamespace(context.Background(), client, ns, true); err != nil {
|
||||
fmt.Println(errors.Wrapf(err, "failed to delete the namespace %q", ns))
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
if err := KibishiiPrepareBeforeBackup(oneHourTimeout, client, providerName, ns,
|
||||
registryCredentialFile, veleroFeatures, kibishiiDirectory, useVolumeSnapshots, DefaultKibishiiData); err != nil {
|
||||
return errors.Wrapf(err, "Failed to install and prepare data for kibishii %s", ns)
|
||||
|
||||
@@ -63,7 +63,9 @@ func BackupsSyncTest() {
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
if !veleroCfg.Debug {
|
||||
if CurrentSpecReport().Failed() && veleroCfg.FailFast {
|
||||
fmt.Println("Test case failed and fail fast is enabled. Skip resource clean up.")
|
||||
} else {
|
||||
By("Clean backups after test", func() {
|
||||
DeleteAllBackups(context.Background(), &veleroCfg)
|
||||
})
|
||||
@@ -82,7 +84,10 @@ func BackupsSyncTest() {
|
||||
By(fmt.Sprintf("Prepare workload as target to backup by creating namespace %s namespace", test.testNS))
|
||||
Expect(CreateNamespace(ctx, *veleroCfg.ClientToInstallVelero, test.testNS)).To(Succeed(),
|
||||
fmt.Sprintf("Failed to create %s namespace", test.testNS))
|
||||
if !veleroCfg.Debug {
|
||||
|
||||
if CurrentSpecReport().Failed() && veleroCfg.FailFast {
|
||||
fmt.Println("Test case failed and fail fast is enabled. Skip resource clean up.")
|
||||
} else {
|
||||
defer func() {
|
||||
Expect(DeleteNamespace(ctx, *veleroCfg.ClientToInstallVelero, test.testNS, false)).To(Succeed(), fmt.Sprintf("Failed to delete the namespace %s", test.testNS))
|
||||
}()
|
||||
@@ -125,12 +130,16 @@ func BackupsSyncTest() {
|
||||
Expect(CreateNamespace(ctx, *veleroCfg.ClientToInstallVelero, test.testNS)).To(Succeed(),
|
||||
fmt.Sprintf("Failed to create %s namespace", test.testNS))
|
||||
})
|
||||
if !veleroCfg.Debug {
|
||||
|
||||
if !CurrentSpecReport().Failed() || !veleroCfg.FailFast {
|
||||
defer func() {
|
||||
Expect(DeleteNamespace(ctx, *veleroCfg.ClientToInstallVelero, test.testNS, false)).To(Succeed(),
|
||||
fmt.Sprintf("Failed to delete the namespace %s", test.testNS))
|
||||
}()
|
||||
} else {
|
||||
fmt.Println("Test case failed and fail fast is enabled. Skip resource clean up.")
|
||||
}
|
||||
|
||||
var BackupCfg BackupConfig
|
||||
BackupCfg.BackupName = test.backupName
|
||||
BackupCfg.Namespace = test.testNS
|
||||
|
||||
@@ -74,7 +74,10 @@ func TTLTest() {
|
||||
|
||||
AfterEach(func() {
|
||||
veleroCfg.GCFrequency = ""
|
||||
if !veleroCfg.Debug {
|
||||
|
||||
if CurrentSpecReport().Failed() && veleroCfg.FailFast {
|
||||
fmt.Println("Test case failed and fail fast is enabled. Skip resource clean up.")
|
||||
} else {
|
||||
By("Clean backups after test", func() {
|
||||
DeleteAllBackups(context.Background(), &veleroCfg)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user