fix issue 6255

Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
Lyndon-Li
2023-06-02 16:11:23 +08:00
parent 59965af775
commit 45d7cc9783
6 changed files with 802 additions and 4 deletions
+1 -1
View File
@@ -91,7 +91,7 @@ func GetBackupRepository(ctx context.Context, cli client.Client, namespace strin
return repo, nil
}
func newBackupRepository(namespace string, key BackupRepositoryKey) *velerov1api.BackupRepository {
func NewBackupRepository(namespace string, key BackupRepositoryKey) *velerov1api.BackupRepository {
return &velerov1api.BackupRepository{
ObjectMeta: metav1.ObjectMeta{
Namespace: namespace,
+1 -1
View File
@@ -108,7 +108,7 @@ func (r *Ensurer) repoLock(key BackupRepositoryKey) *sync.Mutex {
}
func (r *Ensurer) createBackupRepositoryAndWait(ctx context.Context, namespace string, backupRepoKey BackupRepositoryKey) (*velerov1api.BackupRepository, error) {
toCreate := newBackupRepository(namespace, backupRepoKey)
toCreate := NewBackupRepository(namespace, backupRepoKey)
if err := r.repoClient.Create(ctx, toCreate, &client.CreateOptions{}); err != nil {
return nil, errors.Wrap(err, "unable to create backup repository resource")
}
+2 -2
View File
@@ -30,7 +30,7 @@ import (
)
func TestEnsureRepo(t *testing.T) {
bkRepoObj := newBackupRepository(velerov1.DefaultNamespace, BackupRepositoryKey{
bkRepoObj := NewBackupRepository(velerov1.DefaultNamespace, BackupRepositoryKey{
VolumeNamespace: "fake-ns",
BackupLocation: "fake-bsl",
RepositoryType: "fake-repo-type",
@@ -121,7 +121,7 @@ func TestEnsureRepo(t *testing.T) {
}
func TestCreateBackupRepositoryAndWait(t *testing.T) {
bkRepoObj := newBackupRepository(velerov1.DefaultNamespace, BackupRepositoryKey{
bkRepoObj := NewBackupRepository(velerov1.DefaultNamespace, BackupRepositoryKey{
VolumeNamespace: "fake-ns",
BackupLocation: "fake-bsl",
RepositoryType: "fake-repo-type",