Skip to content

Commit

Permalink
recall repo maintenance history on restart
Browse files Browse the repository at this point in the history
Signed-off-by: Lyndon-Li <[email protected]>
  • Loading branch information
Lyndon-Li committed Jan 15, 2025
1 parent fc96836 commit 6be1a91
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/repository/maintenance/maintenance.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func WaitAllJobsComplete(ctx context.Context, cli client.Client, repo *velerov1a

history := []velerov1api.BackupRepositoryMaintenanceStatus{}

startPos := len(history) - limit
startPos := len(jobList.Items) - limit
if startPos < 0 {
startPos = 0
}
Expand Down
7 changes: 1 addition & 6 deletions pkg/repository/maintenance/maintenance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ func TestGetJobConfig(t *testing.T) {
}
}

func TestWaitAlJobsComplete(t *testing.T) {
func TestWaitAllJobsComplete(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*2)

veleroNamespace := "velero"
Expand Down Expand Up @@ -680,11 +680,6 @@ func TestWaitAlJobsComplete(t *testing.T) {
jobPodSucceeded3,
},
expectedStatus: []velerov1api.BackupRepositoryMaintenanceStatus{
{
Result: velerov1api.BackupRepositoryMaintenanceSucceeded,
StartTimestamp: &metav1.Time{Time: now},
CompleteTimestamp: &metav1.Time{Time: now.Add(time.Hour)},
},
{
Result: velerov1api.BackupRepositoryMaintenanceFailed,
StartTimestamp: &metav1.Time{Time: now.Add(time.Hour)},
Expand Down

0 comments on commit 6be1a91

Please sign in to comment.