Skip to content

Commit

Permalink
e2e: update e2e test for topologysc
Browse files Browse the repository at this point in the history
Signed-off-by: parth-gr <[email protected]>
  • Loading branch information
parth-gr committed Mar 19, 2024
1 parent 7a2be75 commit a021457
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
8 changes: 5 additions & 3 deletions e2e/rbd.go
Original file line number Diff line number Diff line change
Expand Up @@ -3043,19 +3043,21 @@ var _ = Describe("RBD", func() {
}

By("ensuring created PV has its CSI journal in the CSI journal specific pool")
err = checkPVCCSIJournalInPool(f, pvc, "replicapool")
err = checkPVCCSIJournalInPool(f, pvc, rbdTopologyPool)
if err != nil {
framework.Failf("failed to check csi journal in pool: %v", err)
}

err = deleteJournalInfoInPool(f, pvc, "replicapool")
err = deleteJournalInfoInPool(f, pvc, rbdTopologyPool)
if err != nil {
framework.Failf("failed to delete omap data: %v", err)
}

err = deletePVCAndApp("", f, pvc, app)
if err != nil {
framework.Failf("failed to delete PVC and application: %v", err)
}

validateRBDImageCount(f, 0, defaultRBDPool)
validateOmapCount(f, 0, rbdType, defaultRBDPool, volumesType)

Expand Down Expand Up @@ -3092,7 +3094,7 @@ var _ = Describe("RBD", func() {
framework.Failf("failed to check data pool for image: %v", err)
}

err = deleteJournalInfoInPool(f, pvc, "replicapool")
err = deleteJournalInfoInPool(f, pvc, rbdTopologyPool)
if err != nil {
framework.Failf("failed to delete omap data: %v", err)
}
Expand Down
5 changes: 4 additions & 1 deletion e2e/rbd_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ func createRBDStorageClass(
if name != "" {
sc.Name = name
}
sc.Parameters["pool"] = defaultRBDPool
// add pool only if topologyConstrainedPools is not present
if _, ok := parameters["topologyConstrainedPools"]; !ok {
sc.Parameters["pool"] = defaultRBDPool
}
sc.Parameters["csi.storage.k8s.io/provisioner-secret-namespace"] = cephCSINamespace
sc.Parameters["csi.storage.k8s.io/provisioner-secret-name"] = rbdProvisionerSecretName

Expand Down
1 change: 1 addition & 0 deletions internal/rbd/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ func buildCreateVolumeResponse(req *csi.CreateVolumeRequest, rbdVol *rbdVolume)
},
}
}

return &csi.CreateVolumeResponse{Volume: volume}
}

Expand Down
5 changes: 4 additions & 1 deletion internal/rbd/rbd_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -1270,9 +1270,12 @@ func genVolFromVolumeOptions(
)

rbdVol := &rbdVolume{}

rbdVol.Pool, ok = volOptions["pool"]
if !ok {
return nil, errors.New("missing required parameter pool")
if _, ok = volOptions["topologyConstrainedPools"]; !ok {
return nil, errors.New("empty pool name or topologyConstrainedPools to provision volume")
}
}

rbdVol.DataPool = volOptions["dataPool"]
Expand Down

0 comments on commit a021457

Please sign in to comment.