mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 14:20:19 +00:00
e2e: make use of new helper function for filesystem mode PVC clone
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
parent
25400a7334
commit
c0eca87268
68
e2e/rbd.go
68
e2e/rbd.go
@ -517,73 +517,9 @@ var _ = Describe("RBD", func() {
|
|||||||
}
|
}
|
||||||
// pvc clone is only supported from v1.16+
|
// pvc clone is only supported from v1.16+
|
||||||
if v.Major > "1" || (v.Major == "1" && v.Minor >= "16") {
|
if v.Major > "1" || (v.Major == "1" && v.Minor >= "16") {
|
||||||
var wg sync.WaitGroup
|
validatePVCClone(pvcPath, pvcSmartClonePath, appSmartClonePath, f)
|
||||||
totalCount := 10
|
|
||||||
pvc, err := loadPVC(pvcPath)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to load PVC with error %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
pvc.Namespace = f.UniqueName
|
|
||||||
err = createPVCAndvalidatePV(f.ClientSet, pvc, deployTimeout)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to create PVC with error %v", err)
|
|
||||||
}
|
|
||||||
// validate created backend rbd images
|
|
||||||
validateRBDImageCount(f, 1)
|
|
||||||
pvcClone, err := loadPVC(pvcSmartClonePath)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to load PVC with error %v", err)
|
|
||||||
}
|
|
||||||
pvcClone.Spec.DataSource.Name = pvc.Name
|
|
||||||
pvcClone.Namespace = f.UniqueName
|
|
||||||
appClone, err := loadApp(appSmartClonePath)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to load application with error %v", err)
|
|
||||||
}
|
|
||||||
appClone.Namespace = f.UniqueName
|
|
||||||
wg.Add(totalCount)
|
|
||||||
// create clone and bind it to an app
|
|
||||||
for i := 0; i < totalCount; i++ {
|
|
||||||
go func(w *sync.WaitGroup, n int, p v1.PersistentVolumeClaim, a v1.Pod) {
|
|
||||||
name := fmt.Sprintf("%s%d", f.UniqueName, n)
|
|
||||||
err = createPVCAndApp(name, f, &p, &a, deployTimeout)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to create PVC with error %v", err)
|
|
||||||
}
|
|
||||||
w.Done()
|
|
||||||
}(&wg, i, *pvcClone, *appClone)
|
|
||||||
}
|
|
||||||
wg.Wait()
|
|
||||||
|
|
||||||
// total images in cluster is 1 parent rbd image+ total
|
|
||||||
// temporary clone+ total clones
|
|
||||||
totalCloneCount := totalCount + totalCount + 1
|
|
||||||
validateRBDImageCount(f, totalCloneCount)
|
|
||||||
// delete parent pvc
|
|
||||||
err = deletePVCAndValidatePV(f.ClientSet, pvc, deployTimeout)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to delete PVC with error %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
totalCloneCount = totalCount + totalCount
|
|
||||||
validateRBDImageCount(f, totalCloneCount)
|
|
||||||
wg.Add(totalCount)
|
|
||||||
// delete clone and app
|
|
||||||
for i := 0; i < totalCount; i++ {
|
|
||||||
go func(w *sync.WaitGroup, n int, p v1.PersistentVolumeClaim, a v1.Pod) {
|
|
||||||
name := fmt.Sprintf("%s%d", f.UniqueName, n)
|
|
||||||
p.Spec.DataSource.Name = name
|
|
||||||
err = deletePVCAndApp(name, f, &p, &a)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to delete PVC and application with error %v", err)
|
|
||||||
}
|
|
||||||
w.Done()
|
|
||||||
}(&wg, i, *pvcClone, *appClone)
|
|
||||||
}
|
|
||||||
wg.Wait()
|
|
||||||
validateRBDImageCount(f, 0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
By("create a block type PVC and bind it to an app", func() {
|
By("create a block type PVC and bind it to an app", func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user