mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-04 04:04:02 +00:00
Improve the UT code coverage for pkg/podvolume
Improve the UT code coverage for pkg/podvolume Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
This commit is contained in:
@@ -319,7 +319,7 @@ func TestBackupPodVolumes(t *testing.T) {
|
|||||||
veleroClientObj []runtime.Object
|
veleroClientObj []runtime.Object
|
||||||
veleroReactors []reactor
|
veleroReactors []reactor
|
||||||
runtimeScheme *runtime.Scheme
|
runtimeScheme *runtime.Scheme
|
||||||
pvbs []*velerov1api.PodVolumeBackup
|
pvbs int
|
||||||
errs []string
|
errs []string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
@@ -486,6 +486,25 @@ func TestBackupPodVolumes(t *testing.T) {
|
|||||||
uploaderType: "kopia",
|
uploaderType: "kopia",
|
||||||
bsl: "fake-bsl",
|
bsl: "fake-bsl",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "return completed pvbs",
|
||||||
|
volumes: []string{
|
||||||
|
"fake-volume-1",
|
||||||
|
},
|
||||||
|
sourcePod: createPodObj(true, true, true, 1),
|
||||||
|
kubeClientObj: []runtime.Object{
|
||||||
|
createNodeAgentPodObj(true),
|
||||||
|
createPVCObj(1),
|
||||||
|
createPVObj(1, false),
|
||||||
|
},
|
||||||
|
ctlClientObj: []runtime.Object{
|
||||||
|
createBackupRepoObj(),
|
||||||
|
},
|
||||||
|
runtimeScheme: scheme,
|
||||||
|
uploaderType: "kopia",
|
||||||
|
bsl: "fake-bsl",
|
||||||
|
pvbs: 1,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
// TODO add more verification around PVCBackupSummary returned by "BackupPodVolumes"
|
// TODO add more verification around PVCBackupSummary returned by "BackupPodVolumes"
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
@@ -533,7 +552,7 @@ func TestBackupPodVolumes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.Equal(t, test.pvbs, pvbs)
|
assert.Len(t, pvbs, test.pvbs)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user