cleanup: error is not nil but returns nil

In few places the error is not nil still it
returns nil.

Updates: #1586

Signed-off-by: Yati Padia <ypadia@redhat.com>
This commit is contained in:
Yati Padia 2021-06-25 17:07:24 +05:30 committed by mergify[bot]
parent 5dc60126e4
commit c851b69160
3 changed files with 4 additions and 4 deletions

View File

@ -68,7 +68,7 @@ func createPVCAndvalidatePV(c kubernetes.Interface, pvc *v1.PersistentVolumeClai
}
err = e2epv.WaitOnPVandPVC(c, pvc.Namespace, pv, pvc)
if err != nil {
return false, nil
return false, fmt.Errorf("failed to wait for the pv and pvc to bind: %w", err)
}
return true, nil
})

View File

@ -44,7 +44,7 @@ func createRBDStorageClass(
scPath := fmt.Sprintf("%s/%s", rbdExamplePath, "storageclass.yaml")
sc, err := getStorageClass(scPath)
if err != nil {
return nil
return fmt.Errorf("failed to get sc: %w", err)
}
if name != "" {
sc.Name = name

View File

@ -311,7 +311,7 @@ func validateNormalUserPVCAccess(pvcPath string, f *framework.Framework) error {
}
_, stdErr, err := execCommandInPod(f, "echo testing > /target/testing", app.Namespace, &opt)
if err != nil {
return nil
return fmt.Errorf("failed to exec command in pod: %w", err)
}
if stdErr != "" {
return fmt.Errorf("failed to touch a file as non-root user %v", stdErr)
@ -395,7 +395,7 @@ func checkDataPersist(pvcPath, appPath string, f *framework.Framework) error {
_, stdErr, err := execCommandInPod(f, fmt.Sprintf("echo %s > %s", data, filePath), app.Namespace, &opt)
if err != nil {
return nil
return fmt.Errorf("failed to exec command in pod: %w", err)
}
if stdErr != "" {
return fmt.Errorf("failed to write data to a file %v", stdErr)