Don't generate empty structure.

VolumeInfo contains several sub-structures. They are filled for
different scenarios. Do not generate empty structure for the
not filled sub-structures.

Signed-off-by: Xun Jiang <jxun@vmware.com>
This commit is contained in:
Xun Jiang
2023-12-19 17:12:34 +08:00
parent 89cbdac0a3
commit 9be8eb0c6d
7 changed files with 132 additions and 75 deletions

View File

@@ -88,7 +88,7 @@ func TestRestorePVWithVolumeInfo(t *testing.T) {
"pv-1": {
BackupMethod: internalVolume.NativeSnapshot,
PVName: "pv-1",
NativeSnapshotInfo: internalVolume.NativeSnapshotInfo{
NativeSnapshotInfo: &internalVolume.NativeSnapshotInfo{
SnapshotHandle: "testSnapshotHandle",
},
},
@@ -112,7 +112,7 @@ func TestRestorePVWithVolumeInfo(t *testing.T) {
"pv-1": {
BackupMethod: internalVolume.PodVolumeBackup,
PVName: "pv-1",
PVBInfo: internalVolume.PodVolumeBackupInfo{
PVBInfo: &internalVolume.PodVolumeBackupInfo{
SnapshotHandle: "testSnapshotHandle",
Size: 100,
NodeName: "testNode",
@@ -139,7 +139,7 @@ func TestRestorePVWithVolumeInfo(t *testing.T) {
BackupMethod: internalVolume.CSISnapshot,
SnapshotDataMoved: false,
PVName: "pv-1",
CSISnapshotInfo: internalVolume.CSISnapshotInfo{
CSISnapshotInfo: &internalVolume.CSISnapshotInfo{
Driver: "pd.csi.storage.gke.io",
},
},
@@ -164,10 +164,10 @@ func TestRestorePVWithVolumeInfo(t *testing.T) {
BackupMethod: internalVolume.CSISnapshot,
SnapshotDataMoved: true,
PVName: "pv-1",
CSISnapshotInfo: internalVolume.CSISnapshotInfo{
CSISnapshotInfo: &internalVolume.CSISnapshotInfo{
Driver: "pd.csi.storage.gke.io",
},
SnapshotDataMovementInfo: internalVolume.SnapshotDataMovementInfo{
SnapshotDataMovementInfo: &internalVolume.SnapshotDataMovementInfo{
DataMover: "velero",
},
},