Skip to content

Commit

Permalink
Surface errors when waiting for backupRepository
Browse files Browse the repository at this point in the history
Make errors such as those found in #6928 (comment)

Makes errors easier to understand than "timed out waiting for the condition"

Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
  • Loading branch information
kaovilai committed May 7, 2024
1 parent 4d48273 commit 5c2592d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/7762-kaovilai
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Surface errors when waiting for backupRepository and timeout occurs
2 changes: 0 additions & 2 deletions pkg/repository/ensurer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/repository/ensurer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ 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",
namespace: "fake-ns",
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",
},
}

Expand Down Expand Up @@ -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",
},
}

Expand Down

0 comments on commit 5c2592d

Please sign in to comment.