replace TestBackup with pkg/backup.Builder (#1593)

Signed-off-by: Steve Kriss <krisss@vmware.com>
This commit is contained in:
Steve Kriss
2019-06-21 15:08:08 -06:00
committed by Adnan Abdulhussein
parent d916ae0a25
commit 19052994ed
10 changed files with 330 additions and 405 deletions

View File

@@ -266,7 +266,7 @@ func TestBackupDeletionControllerProcessRequest(t *testing.T) {
})
t.Run("patching to InProgress fails", func(t *testing.T) {
backup := velerotest.NewTestBackup().WithName("foo").WithStorageLocation("default").Backup
backup := defaultBackup().Name("foo").StorageLocation("default").Backup()
location := velerotest.NewTestBackupStorageLocation().WithName("default").BackupStorageLocation
td := setupBackupDeletionControllerTest(backup)
@@ -298,7 +298,7 @@ func TestBackupDeletionControllerProcessRequest(t *testing.T) {
})
t.Run("patching backup to Deleting fails", func(t *testing.T) {
backup := velerotest.NewTestBackup().WithName("foo").WithStorageLocation("default").Backup
backup := defaultBackup().Name("foo").StorageLocation("default").Backup()
location := velerotest.NewTestBackupStorageLocation().WithName("default").BackupStorageLocation
td := setupBackupDeletionControllerTest(backup)
@@ -364,7 +364,7 @@ func TestBackupDeletionControllerProcessRequest(t *testing.T) {
})
t.Run("unable to find backup storage location", func(t *testing.T) {
backup := velerotest.NewTestBackup().WithName("foo").WithStorageLocation("default").Backup
backup := defaultBackup().Name("foo").StorageLocation("default").Backup()
td := setupBackupDeletionControllerTest(backup)
@@ -390,7 +390,7 @@ func TestBackupDeletionControllerProcessRequest(t *testing.T) {
})
t.Run("backup storage location is in read-only mode", func(t *testing.T) {
backup := velerotest.NewTestBackup().WithName("foo").WithStorageLocation("default").Backup
backup := defaultBackup().Name("foo").StorageLocation("default").Backup()
location := velerotest.NewTestBackupStorageLocation().WithName("default").WithAccessMode(v1.BackupStorageLocationAccessModeReadOnly).BackupStorageLocation
td := setupBackupDeletionControllerTest(backup)
@@ -419,7 +419,7 @@ func TestBackupDeletionControllerProcessRequest(t *testing.T) {
})
t.Run("full delete, no errors", func(t *testing.T) {
backup := velerotest.NewTestBackup().WithName("foo").Backup
backup := defaultBackup().Name("foo").Backup()
backup.UID = "uid"
backup.Spec.StorageLocation = "primary"
@@ -565,7 +565,7 @@ func TestBackupDeletionControllerProcessRequest(t *testing.T) {
})
t.Run("full delete, no errors, with backup name greater than 63 chars", func(t *testing.T) {
backup := velerotest.NewTestBackup().WithName("the-really-long-backup-name-that-is-much-more-than-63-characters").Backup
backup := defaultBackup().Name("the-really-long-backup-name-that-is-much-more-than-63-characters").Backup()
backup.UID = "uid"
backup.Spec.StorageLocation = "primary"