e2e: add snapshot count validation

Add snapshot count validation for cephfs
and nfs to avoid resource leak.

fixes: #3224

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2022-11-02 11:50:16 +01:00
committed by mergify[bot]
parent c5a6d11a8f
commit 28f51aaaf7
3 changed files with 70 additions and 4 deletions

View File

@ -616,6 +616,11 @@ var _ = Describe("nfs", func() {
e2elog.Failf("failed to calculate checksum: %v", err)
}
_, pv, err := getPVCAndPV(f.ClientSet, pvc.Name, pvc.Namespace)
if err != nil {
e2elog.Failf("failed to get PV object for %s: %v", pvc.Name, err)
}
snap := getSnapshot(snapshotPath)
snap.Namespace = f.UniqueName
snap.Spec.Source.PersistentVolumeClaimName = &pvc.Name
@ -640,6 +645,7 @@ var _ = Describe("nfs", func() {
if failed != 0 {
e2elog.Failf("creating snapshots failed, %d errors were logged", failed)
}
validateCephFSSnapshotCount(f, totalCount, defaultSubvolumegroup, pv)
pvcClone, err := loadPVC(pvcClonePath)
if err != nil {
@ -812,6 +818,8 @@ var _ = Describe("nfs", func() {
e2elog.Failf("deleting snapshots failed, %d errors were logged", failed)
}
validateCephFSSnapshotCount(f, 0, defaultSubvolumegroup, pv)
wg.Add(totalCount)
// delete clone and app
for i := 0; i < totalCount; i++ {