Skip to content

Commit

Permalink
e2e: remove volume populate test case and also change writeDataInPod()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
humblec authored and mergify[bot] committed Aug 8, 2020
1 parent 7d2bba1 commit ef1785c
Showing 1 changed file with 24 additions and 68 deletions.
92 changes: 24 additions & 68 deletions e2e/cephfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,18 @@ var _ = Describe("cephfs", func() {
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.Namespace = f.UniqueName
snap.Spec.Source.PersistentVolumeClaimName = &pvc.Name
Expand Down Expand Up @@ -503,7 +515,7 @@ var _ = Describe("cephfs", func() {
wg.Wait()

// delete parent pvc
err = deletePVCAndValidatePV(f.ClientSet, pvc, deployTimeout)
err = deletePVCAndApp("", f, pvc, app)
if err != nil {
Fail(err.Error())
}
Expand All @@ -530,6 +542,16 @@ var _ = Describe("cephfs", func() {
if err != nil {
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)
if err != nil {
Expand All @@ -556,7 +578,7 @@ var _ = Describe("cephfs", func() {
}
wg.Wait()
// delete parent pvc
err = deletePVCAndValidatePV(f.ClientSet, pvc, deployTimeout)
err = deletePVCAndApp("", f, pvc, app)
if err != nil {
Fail(err.Error())
}
Expand All @@ -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() {
// create pvc and bind it to an app
pvc, err := loadPVC(pvcPath)
Expand Down

0 comments on commit ef1785c

Please sign in to comment.