Skip to content

Commit

Permalink
Updated object store unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
dsu-igeek committed Dec 6, 2021
1 parent cb5cc7d commit 36740aa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 0 additions & 8 deletions pkg/persistence/object_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,6 @@ func (s *objectBackupStore) PutBackup(info BackupInfo) error {
}
}

/*
if info.Metadata == nil {
// If we don't have metadata, something failed, and there's no point in continuing. An object
// storage bucket that is missing the metadata file can't be restored, nor can its logs be
// viewed.
return nil
}
*/
if info.Metadata != nil {
if err := seekAndPutObject(s.objectStore, s.bucket, s.layout.getBackupMetadataKey(info.Name), info.Metadata); err != nil {
// failure to upload metadata file is a hard-stop
Expand Down
10 changes: 8 additions & 2 deletions pkg/persistence/object_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,15 +312,21 @@ func TestPutBackup(t *testing.T) {
},
},
{
name: "don't upload data when metadata is nil",
name: "data should be uploaded even when metadata is nil",
metadata: nil,
contents: newStringReadSeeker("contents"),
log: newStringReadSeeker("log"),
podVolumeBackup: newStringReadSeeker("podVolumeBackup"),
snapshots: newStringReadSeeker("snapshots"),
resourceList: newStringReadSeeker("resourceList"),
expectedErr: "",
expectedKeys: []string{"backups/backup-1/backup-1-logs.gz"},
expectedKeys: []string{
"backups/backup-1/backup-1.tar.gz",
"backups/backup-1/backup-1-logs.gz",
"backups/backup-1/backup-1-podvolumebackups.json.gz",
"backups/backup-1/backup-1-volumesnapshots.json.gz",
"backups/backup-1/backup-1-resource-list.json.gz",
},
},
}

Expand Down

0 comments on commit 36740aa

Please sign in to comment.