mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-08 14:21:18 +00:00
Merge pull request #66 from skriss/getallbackups-fix
in GetAllBackups don't error if single backup is unreadable
This commit is contained in:
@@ -115,7 +115,8 @@ func (br *backupService) GetAllBackups(bucket string) ([]*api.Backup, error) {
|
||||
for _, backupDir := range prefixes {
|
||||
backup, err := br.GetBackup(bucket, backupDir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
glog.Errorf("Error reading backup directory %s: %v", backupDir, err)
|
||||
continue
|
||||
}
|
||||
|
||||
output = append(output, backup)
|
||||
|
||||
@@ -271,7 +271,7 @@ func TestGetAllBackups(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "decode error returns nil/error",
|
||||
name: "backup that can't be decoded is ignored",
|
||||
bucket: "test-bucket",
|
||||
storage: map[string]map[string][]byte{
|
||||
"test-bucket": map[string][]byte{
|
||||
@@ -279,7 +279,12 @@ func TestGetAllBackups(t *testing.T) {
|
||||
"backup-2/ark-backup.json": []byte("this is not valid backup JSON"),
|
||||
},
|
||||
},
|
||||
expectedErr: true,
|
||||
expectedRes: []*api.Backup{
|
||||
&api.Backup{
|
||||
TypeMeta: metav1.TypeMeta{Kind: "Backup", APIVersion: "ark.heptio.com/v1"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "backup-1"},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user