From c9973a3755b3e54343340e4ace4eaa9d17bf3f44 Mon Sep 17 00:00:00 2001 From: Mattia Eleuteri Date: Thu, 8 Oct 2026 14:09:08 +0200 Subject: [PATCH] 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 (cherry picked from commit 06e72b26dd73c69beb2933122773277bd7efc8e8) Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com> --- internal/backupcontroller/stale_cache_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/backupcontroller/stale_cache_test.go b/internal/backupcontroller/stale_cache_test.go index 897e0fb05..916f562c5 100644 --- a/internal/backupcontroller/stale_cache_test.go +++ b/internal/backupcontroller/stale_cache_test.go @@ -152,7 +152,11 @@ func TestReconcileRestore_DoesNotRetryAJobItAlreadyFailed(t *testing.T) { Status: backupsv1alpha1.RestoreJobStatus{StartedAt: &started, Phase: backupsv1alpha1.RestoreJobPhaseRunning}, } strategy := &strategyv1alpha1.Velero{ObjectMeta: metav1.ObjectMeta{Name: "velero"}} - c := clientfake.NewClientBuilder().WithScheme(s).WithObjects(rj, backup, strategy). + veleroBackup := &velerov1.Backup{ + ObjectMeta: metav1.ObjectMeta{Name: "vb", Namespace: veleroNamespace}, + Status: velerov1.BackupStatus{Phase: velerov1.BackupPhaseCompleted}, + } + c := clientfake.NewClientBuilder().WithScheme(s).WithObjects(rj, backup, strategy, veleroBackup). WithStatusSubresource(&backupsv1alpha1.RestoreJob{}).Build() dyn := dynamicfake.NewSimpleDynamicClient(testCNPGScheme(t), makeUnstructuredHelmRelease(hrName, ns, nil)) r := &RestoreJobReconciler{