From 5c2592d72f7b43c9c70c584524681a141eb24a7b Mon Sep 17 00:00:00 2001 From: Tiger Kaovilai Date: Tue, 30 Apr 2024 15:16:56 -0400 Subject: [PATCH] Surface errors when waiting for backupRepository Make errors such as those found in https://github.com/vmware-tanzu/velero/issues/6928#issuecomment-1759369183 Makes errors easier to understand than "timed out waiting for the condition" Signed-off-by: Tiger Kaovilai --- changelogs/unreleased/7762-kaovilai | 1 + pkg/repository/ensurer.go | 2 -- pkg/repository/ensurer_test.go | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-) create mode 100644 changelogs/unreleased/7762-kaovilai diff --git a/changelogs/unreleased/7762-kaovilai b/changelogs/unreleased/7762-kaovilai new file mode 100644 index 0000000000..6c515123dc --- /dev/null +++ b/changelogs/unreleased/7762-kaovilai @@ -0,0 +1 @@ +Surface errors when waiting for backupRepository and timeout occurs diff --git a/pkg/repository/ensurer.go b/pkg/repository/ensurer.go index 96feeb8fa4..071d2b4e25 100644 --- a/pkg/repository/ensurer.go +++ b/pkg/repository/ensurer.go @@ -122,8 +122,6 @@ func (r *Ensurer) waitBackupRepository(ctx context.Context, namespace string, ba if err == nil { repo = found return true, nil - } else if isBackupRepositoryNotFoundError(err) || isBackupRepositoryNotProvisionedError(err) { - return false, nil } else { return false, err } diff --git a/pkg/repository/ensurer_test.go b/pkg/repository/ensurer_test.go index a5128c9b44..d7f67094f4 100644 --- a/pkg/repository/ensurer_test.go +++ b/pkg/repository/ensurer_test.go @@ -102,7 +102,7 @@ func TestEnsureRepo(t *testing.T) { bkRepoObjNotReady, }, runtimeScheme: scheme, - err: "failed to wait BackupRepository: context deadline exceeded", + err: "failed to wait BackupRepository: backup repository not provisioned", }, { name: "create fail", @@ -110,7 +110,7 @@ func TestEnsureRepo(t *testing.T) { bsl: "fake-bsl", repositoryType: "fake-repo-type", runtimeScheme: scheme, - err: "failed to wait BackupRepository: context deadline exceeded", + err: "failed to wait BackupRepository: backup repository not provisioned", }, } @@ -183,7 +183,7 @@ func TestCreateBackupRepositoryAndWait(t *testing.T) { bsl: "fake-bsl", repositoryType: "fake-repo-type", runtimeScheme: scheme, - err: "failed to wait BackupRepository: context deadline exceeded", + err: "failed to wait BackupRepository: backup repository not provisioned", }, }