mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-10 00:10:20 +00:00
e2e: validate the error return instead of object for consitency
If loadPVC() fails, it return error and we expect the PVC object to be nil too. In many places we check on the error and exit. However in few places we are looking at PVC object. This commit make the condition check on `err` instead of `PVC` object for consistency. Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
parent
dc4da25a30
commit
b4452f0787
@ -335,7 +335,7 @@ var _ = Describe("cephfs", func() {
|
|||||||
|
|
||||||
By("create PVC, delete backing subvolume and check pv deletion", func() {
|
By("create PVC, delete backing subvolume and check pv deletion", func() {
|
||||||
pvc, err := loadPVC(pvcPath)
|
pvc, err := loadPVC(pvcPath)
|
||||||
if pvc == nil {
|
if err != nil {
|
||||||
e2elog.Failf("failed to load PVC with error %v", err)
|
e2elog.Failf("failed to load PVC with error %v", err)
|
||||||
}
|
}
|
||||||
pvc.Namespace = f.UniqueName
|
pvc.Namespace = f.UniqueName
|
||||||
|
@ -65,13 +65,13 @@ func resizePVCAndValidateSize(pvcPath, appPath string, f *framework.Framework) e
|
|||||||
size := "1Gi"
|
size := "1Gi"
|
||||||
expandSize := "10Gi"
|
expandSize := "10Gi"
|
||||||
pvc, err := loadPVC(pvcPath)
|
pvc, err := loadPVC(pvcPath)
|
||||||
if pvc == nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
pvc.Namespace = f.UniqueName
|
pvc.Namespace = f.UniqueName
|
||||||
|
|
||||||
resizePvc, err := loadPVC(pvcPath)
|
resizePvc, err := loadPVC(pvcPath)
|
||||||
if resizePvc == nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
resizePvc.Namespace = f.UniqueName
|
resizePvc.Namespace = f.UniqueName
|
||||||
|
@ -142,7 +142,7 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
|||||||
label := make(map[string]string)
|
label := make(map[string]string)
|
||||||
|
|
||||||
pvc, err = loadPVC(pvcPath)
|
pvc, err = loadPVC(pvcPath)
|
||||||
if pvc == nil {
|
if err != nil {
|
||||||
e2elog.Failf("failed to load pvc with error %v", err)
|
e2elog.Failf("failed to load pvc with error %v", err)
|
||||||
}
|
}
|
||||||
pvc.Namespace = f.UniqueName
|
pvc.Namespace = f.UniqueName
|
||||||
|
@ -160,7 +160,7 @@ var _ = Describe("RBD Upgrade Testing", func() {
|
|||||||
data := "check data persists"
|
data := "check data persists"
|
||||||
|
|
||||||
pvc, err = loadPVC(pvcPath)
|
pvc, err = loadPVC(pvcPath)
|
||||||
if pvc == nil {
|
if err != nil {
|
||||||
e2elog.Failf("failed to load pvc with error %v", err)
|
e2elog.Failf("failed to load pvc with error %v", err)
|
||||||
}
|
}
|
||||||
pvc.Namespace = f.UniqueName
|
pvc.Namespace = f.UniqueName
|
||||||
|
@ -188,7 +188,7 @@ func deletePVCAndApp(name string, f *framework.Framework, pvc *v1.PersistentVolu
|
|||||||
|
|
||||||
func createPVCAndAppBinding(pvcPath, appPath string, f *framework.Framework, pvcTimeout int) (*v1.PersistentVolumeClaim, *v1.Pod, error) {
|
func createPVCAndAppBinding(pvcPath, appPath string, f *framework.Framework, pvcTimeout int) (*v1.PersistentVolumeClaim, *v1.Pod, error) {
|
||||||
pvc, err := loadPVC(pvcPath)
|
pvc, err := loadPVC(pvcPath)
|
||||||
if pvc == nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
pvc.Namespace = f.UniqueName
|
pvc.Namespace = f.UniqueName
|
||||||
@ -356,7 +356,7 @@ func writeDataInPod(app *v1.Pod, f *framework.Framework) error {
|
|||||||
func checkDataPersist(pvcPath, appPath string, f *framework.Framework) error {
|
func checkDataPersist(pvcPath, appPath string, f *framework.Framework) error {
|
||||||
data := "checking data persist"
|
data := "checking data persist"
|
||||||
pvc, err := loadPVC(pvcPath)
|
pvc, err := loadPVC(pvcPath)
|
||||||
if pvc == nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,7 +450,7 @@ func pvcDeleteWhenPoolNotFound(pvcPath string, cephfs bool, f *framework.Framewo
|
|||||||
|
|
||||||
func checkMountOptions(pvcPath, appPath string, f *framework.Framework, mountFlags []string) error {
|
func checkMountOptions(pvcPath, appPath string, f *framework.Framework, mountFlags []string) error {
|
||||||
pvc, err := loadPVC(pvcPath)
|
pvc, err := loadPVC(pvcPath)
|
||||||
if pvc == nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user