Skip to content

Commit

Permalink
e2e: validate PVC-PVC clone creation with deleted parent snap
Browse files Browse the repository at this point in the history
This commit modifies a test case to check creation of
PVC-PVC clone of a restored PVC when parent snapshot
is deleted.

Signed-off-by: Rakshith R <[email protected]>
  • Loading branch information
Rakshith-R committed Apr 1, 2024
1 parent 04b0154 commit d48e200
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion e2e/rbd.go
Original file line number Diff line number Diff line change
Expand Up @@ -3552,7 +3552,7 @@ var _ = Describe("RBD", func() {
validateRBDImageCount(f, 1, defaultRBDPool)
validateOmapCount(f, 1, rbdType, defaultRBDPool, volumesType)
for i := 0; i < snapChainDepth; i++ {
var pvcClone *v1.PersistentVolumeClaim
var pvcClone, smartClonePVC *v1.PersistentVolumeClaim
snap := getSnapshot(snapshotPath)
snap.Name = fmt.Sprintf("%s-%d", snap.Name, i)
snap.Namespace = f.UniqueName
Expand Down Expand Up @@ -3609,6 +3609,27 @@ var _ = Describe("RBD", func() {
validateOmapCount(f, 1, rbdType, defaultRBDPool, volumesType)
validateOmapCount(f, 0, rbdType, defaultRBDPool, snapsType)

// create pvc-pvc clone
smartClonePVC, err = loadPVC(pvcSmartClonePath)
if err != nil {
framework.Failf("failed to load smart clone PVC: %v", err)
}

smartClonePVC.Name = fmt.Sprintf("%s-%d", smartClonePVC.Name, i)
smartClonePVC.Namespace = f.UniqueName
smartClonePVC.Spec.DataSource.Name = pvcClone.Name
err = createPVCAndvalidatePV(f.ClientSet, smartClonePVC, deployTimeout)
if err != nil {
framework.Failf("failed to create smart clone PVC %q: %v",
smartClonePVC.Name, err)
}

err = deletePVCAndValidatePV(f.ClientSet, smartClonePVC, deployTimeout)
if err != nil {
framework.Failf("failed to delete smart clone PVC %q: %v",
smartClonePVC.Name, err)
}

app.Spec.Volumes[0].PersistentVolumeClaim.ClaimName = pvcClone.Name
// create application
err = createApp(f.ClientSet, app, deployTimeout)
Expand Down

0 comments on commit d48e200

Please sign in to comment.