e2e: remove volume populate test case and also change writeDataInPod()

As we are populating the volume in other two test cases for clone and
snapshot operation, we dont need a specific test case now.
WriteDataInPod() function is also changed to take the pod spec and write
some data to it

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
Humble Chirammal 2020-08-04 22:28:58 +05:30 committed by mergify[bot]
parent 7d2bba1375
commit ef1785ce4d

View File

@ -393,6 +393,18 @@ var _ = Describe("cephfs", func() {
Fail(err.Error()) Fail(err.Error())
} }
app, err := loadApp(appPath)
if err != nil {
Fail(err.Error())
}
app.Namespace = f.UniqueName
app.Spec.Volumes[0].PersistentVolumeClaim.ClaimName = pvc.Name
wErr := writeDataInPod(app, f)
if wErr != nil {
Fail(wErr.Error())
}
snap := getSnapshot(snapshotPath) snap := getSnapshot(snapshotPath)
snap.Namespace = f.UniqueName snap.Namespace = f.UniqueName
snap.Spec.Source.PersistentVolumeClaimName = &pvc.Name snap.Spec.Source.PersistentVolumeClaimName = &pvc.Name
@ -503,7 +515,7 @@ var _ = Describe("cephfs", func() {
wg.Wait() wg.Wait()
// delete parent pvc // delete parent pvc
err = deletePVCAndValidatePV(f.ClientSet, pvc, deployTimeout) err = deletePVCAndApp("", f, pvc, app)
if err != nil { if err != nil {
Fail(err.Error()) Fail(err.Error())
} }
@ -530,6 +542,16 @@ var _ = Describe("cephfs", func() {
if err != nil { if err != nil {
Fail(err.Error()) Fail(err.Error())
} }
app, err := loadApp(appPath)
if err != nil {
Fail(err.Error())
}
app.Namespace = f.UniqueName
app.Spec.Volumes[0].PersistentVolumeClaim.ClaimName = pvc.Name
wErr := writeDataInPod(app, f)
if wErr != nil {
Fail(wErr.Error())
}
pvcClone, err := loadPVC(pvcSmartClonePath) pvcClone, err := loadPVC(pvcSmartClonePath)
if err != nil { if err != nil {
@ -556,7 +578,7 @@ var _ = Describe("cephfs", func() {
} }
wg.Wait() wg.Wait()
// delete parent pvc // delete parent pvc
err = deletePVCAndValidatePV(f.ClientSet, pvc, deployTimeout) err = deletePVCAndApp("", f, pvc, app)
if err != nil { if err != nil {
Fail(err.Error()) Fail(err.Error())
} }
@ -578,72 +600,6 @@ var _ = Describe("cephfs", func() {
} }
}) })
By("populate source volume, create a PVC-PVC clone and bind it to an app", func() {
v, err := f.ClientSet.Discovery().ServerVersion()
if err != nil {
e2elog.Logf("failed to get server version with error %v", err)
Fail(err.Error())
}
// pvc clone is only supported from v1.16+
if v.Major > "1" || (v.Major == "1" && v.Minor >= "16") {
pvc, err := loadPVC(pvcPath)
if err != nil {
Fail(err.Error())
}
app, err := loadApp(appPath)
if err != nil {
Fail(err.Error())
}
err = createPVCAndvalidatePV(f.ClientSet, pvc, deployTimeout)
if err != nil {
Fail(err.Error())
}
pvc.Namespace = f.UniqueName
wErr := writeDataInPod(app, f)
if wErr != nil {
Fail(wErr.Error())
}
pvcClone, err := loadPVC(pvcSmartClonePath)
if err != nil {
Fail(err.Error())
}
pvcClone.Spec.DataSource.Name = pvc.Name
pvcClone.Namespace = f.UniqueName
appClone, err := loadApp(appSmartClonePath)
if err != nil {
Fail(err.Error())
}
appClone.Namespace = f.UniqueName
totalCount := 1
// create clone and bind it to an app
for i := 0; i < totalCount; i++ {
name := fmt.Sprintf("%s%d", f.UniqueName, i)
err = createPVCAndApp(name, f, pvcClone, appClone, deployTimeout)
if err != nil {
Fail(err.Error())
}
}
// delete parent pvc
err = deletePVCAndApp("", f, pvc, app)
if err != nil {
Fail(err.Error())
}
// delete clone and app
for i := 0; i < totalCount; i++ {
name := fmt.Sprintf("%s%d", f.UniqueName, i)
pvcClone.Spec.DataSource.Name = name
err = deletePVCAndApp(name, f, pvcClone, appClone)
if err != nil {
Fail(err.Error())
}
}
}
})
By("Create ROX PVC and Bind it to an app", func() { By("Create ROX PVC and Bind it to an app", func() {
// create pvc and bind it to an app // create pvc and bind it to an app
pvc, err := loadPVC(pvcPath) pvc, err := loadPVC(pvcPath)