Skip to content

Commit

Permalink
cleanup: error is not nil but returns nil
Browse files Browse the repository at this point in the history
In few places the error is not nil still it
returns nil.

Updates: #1586

Signed-off-by: Yati Padia <ypadia@redhat.com>
  • Loading branch information
yati1998 committed Jun 25, 2021
1 parent 0ee0c12 commit f322c1b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion e2e/pvc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
2 changes: 1 addition & 1 deletion e2e/rbd_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func createRBDStorageClass(c kubernetes.Interface, f *framework.Framework, name
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
Expand Down
4 changes: 2 additions & 2 deletions e2e/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,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)
Expand Down Expand Up @@ -378,7 +378,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)
Expand Down

0 comments on commit f322c1b

Please sign in to comment.