Skip to content

Commit

Permalink
fix(BDD): update checks after de-provisioning the CStor Volume (#1715)
Browse files Browse the repository at this point in the history
Signed-off-by: mittachaitu <[email protected]>
  • Loading branch information
sai chaithanya authored and kmova committed Jun 11, 2020
1 parent 5aaccbc commit 87ce0ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions pkg/webhook/spc.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ func (wh *webhook) validateSPCDeleteRequest(req *v1beta1.AdmissionRequest) *v1be
})
if err != nil {
err = errors.Wrapf(err, "Could not list cvr for csp %s", cspObj.Name)
klog.Error(err)
response = BuildForAPIObject(response).UnSetAllowed().WithResultAsFailure(err, http.StatusBadRequest).AR
return response
}
if len(cvrList.Items) != 0 {
err := errors.Errorf("invalid spc %s deletion: volumereplicas still exists on pool %s", req.Name, cspObj.Name)
klog.Error(err)
response = BuildForAPIObject(response).UnSetAllowed().WithResultAsFailure(err, http.StatusUnprocessableEntity).AR
return response
}
Expand Down
12 changes: 6 additions & 6 deletions tests/cstor/volume/provision_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,12 @@ var _ = Describe("[Cstor Volume Provisioning Positive] TEST VOLUME PROVISIONING"

By("verifying target pod count as 0")
targetVolumeLabel = pvLabel + volname
controllerPodCount = ops.GetPodRunningCountEventually(openebsNamespace, targetVolumeLabel, 1)
Expect(controllerPodCount).To(Equal(1), "while checking controller pod count")
controllerPodCount = ops.GetPodRunningCountEventually(openebsNamespace, targetVolumeLabel, 0)
Expect(controllerPodCount).To(Equal(0), "while checking controller pod count")

By("verifying cstorvolume replica count")
cvrLabel = pvLabel + volname
cvrCount = ops.GetCstorVolumeReplicaCountEventually(openebsNamespace, cvrLabel, 0, cvr.IsErrored())
cvrCount = ops.GetCstorVolumeReplicaCountEventually(openebsNamespace, cvrLabel, 0)
Expect(cvrCount).To(Equal(true), "while checking cstorvolume replica count")
})
})
Expand Down Expand Up @@ -337,12 +337,12 @@ var _ = Describe("[Cstor Volume Provisioning Positive] TEST VOLUME PROVISIONING"

By("verifying target pod count as 0")
targetVolumeLabel = pvLabel + volname
controllerPodCount = ops.GetPodRunningCountEventually(openebsNamespace, targetVolumeLabel, 1)
Expect(controllerPodCount).To(Equal(1), "while checking controller pod count")
controllerPodCount = ops.GetPodRunningCountEventually(openebsNamespace, targetVolumeLabel, 0)
Expect(controllerPodCount).To(Equal(0), "while checking controller pod count")

By("verifying cstorvolume replica count")
cvrLabel = pvLabel + volname
cvrCount = ops.GetCstorVolumeReplicaCountEventually(openebsNamespace, cvrLabel, 0, cvr.IsErrored())
cvrCount = ops.GetCstorVolumeReplicaCountEventually(openebsNamespace, cvrLabel, 0)
Expect(cvrCount).To(Equal(true), "while checking cstorvolume replica count")
})

Expand Down

0 comments on commit 87ce0ca

Please sign in to comment.