diff --git a/pkg/webhook/spc.go b/pkg/webhook/spc.go index 9717a988d1..81c1c16209 100644 --- a/pkg/webhook/spc.go +++ b/pkg/webhook/spc.go @@ -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 } diff --git a/tests/cstor/volume/provision_test.go b/tests/cstor/volume/provision_test.go index abfa36ca58..9652bb9180 100644 --- a/tests/cstor/volume/provision_test.go +++ b/tests/cstor/volume/provision_test.go @@ -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") }) }) @@ -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") })