Skip to content

Commit 06e72b2

Browse files
test(backups): give the restore stale-cache test a Completed Velero Backup
A Velero RestoreJob is about to require its Velero Backup to exist and be Completed before it halts the application. Without one in the fixture, the first pass of this test fails the RestoreJob before it suspends the HelmRelease, so the test would stop exercising the stale cache it is about. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <[email protected]>
1 parent eafa441 commit 06e72b2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎internal/backupcontroller/stale_cache_test.go‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,11 @@ func TestReconcileRestore_DoesNotRetryAJobItAlreadyFailed(t *testing.T) {
152152
Status: backupsv1alpha1.RestoreJobStatus{StartedAt: &started, Phase: backupsv1alpha1.RestoreJobPhaseRunning},
153153
}
154154
strategy := &strategyv1alpha1.Velero{ObjectMeta: metav1.ObjectMeta{Name: "velero"}}
155-
c := clientfake.NewClientBuilder().WithScheme(s).WithObjects(rj, backup, strategy).
155+
veleroBackup := &velerov1.Backup{
156+
ObjectMeta: metav1.ObjectMeta{Name: "vb", Namespace: veleroNamespace},
157+
Status: velerov1.BackupStatus{Phase: velerov1.BackupPhaseCompleted},
158+
}
159+
c := clientfake.NewClientBuilder().WithScheme(s).WithObjects(rj, backup, strategy, veleroBackup).
156160
WithStatusSubresource(&backupsv1alpha1.RestoreJob{}).Build()
157161
dyn := dynamicfake.NewSimpleDynamicClient(testCNPGScheme(t), makeUnstructuredHelmRelease(hrName, ns, nil))
158162
r := &RestoreJobReconciler{

0 commit comments

Comments
 (0)