mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-07 05:46:37 +00:00
Merge pull request #1389 from skriss/restore-partially-failed
Add PartiallyFailed phase for restores
This commit is contained in:
@@ -259,6 +259,10 @@ func (c *restoreController) processRestore(restore *api.Restore) error {
|
||||
restore.Status.Phase = api.RestorePhaseFailed
|
||||
restore.Status.FailureReason = err.Error()
|
||||
c.metrics.RegisterRestoreFailed(backupScheduleName)
|
||||
} else if restore.Status.Errors > 0 {
|
||||
c.logger.Debug("Restore partially failed")
|
||||
restore.Status.Phase = api.RestorePhasePartiallyFailed
|
||||
c.metrics.RegisterRestorePartialFailure(backupScheduleName)
|
||||
} else {
|
||||
c.logger.Debug("Restore completed")
|
||||
restore.Status.Phase = api.RestorePhaseCompleted
|
||||
|
||||
@@ -300,6 +300,7 @@ func TestProcessQueueItem(t *testing.T) {
|
||||
restorerError: errors.New("blarg"),
|
||||
expectedErr: false,
|
||||
expectedPhase: string(api.RestorePhaseInProgress),
|
||||
expectedFinalPhase: string(api.RestorePhasePartiallyFailed),
|
||||
expectedRestoreErrors: 1,
|
||||
expectedRestorerCall: NewRestore("foo", "bar", "backup-1", "ns-1", "", api.RestorePhaseInProgress).Restore,
|
||||
},
|
||||
@@ -595,7 +596,7 @@ func TestProcessQueueItem(t *testing.T) {
|
||||
if test.expectedFinalPhase != "" {
|
||||
expected = Patch{
|
||||
Status: StatusPatch{
|
||||
Phase: api.RestorePhaseCompleted,
|
||||
Phase: api.RestorePhase(test.expectedFinalPhase),
|
||||
Errors: test.expectedRestoreErrors,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user