civo / civo-csi

A Container Storage Interface plugin/driver for Civo's managed k3s service
https://www.civo.com/kube100
2 stars 2 forks source link

Add proper error handling and remove unnecessary variable definition #28

Closed hlts2 closed 3 days ago

hlts2 commented 3 days ago

WHAT

I fixed an small issue where errors were not being handled correctly in the test code. Additionally, I removed an unnecessary variable definition.

WHY

There were parts of the test code where errors were being handled, but no errors were assigned. I believe this needs to be fixed.

err = e2eTest.tenantClient.Get(context.TODO(), client.ObjectKey{Namespace: "kube-system", Name: "civo-csi-controller"}, controller) if err != nil { log.Panic(err) }

controller.Spec.Template.Spec.Containers[3].Image = Image

e2eTest.tenantClient.Update(context.TODO(), controller) <- we need to assign result to err variable if err != nil { log.Panic(err) }


I also found sections where the code worked correctly without the variable definition, so I removed it.

## FYI

- The following is the result of all unit test on Local environment
```sh
❯ go clean -testcache && go test ./...
ok      github.com/civo/civo-csi    70.103s
ok      github.com/civo/civo-csi/e2e    0.007s
ok      github.com/civo/civo-csi/pkg/driver 10.013s
hlts2 commented 3 days ago

@Praveen005 Thank you for reviewing it! I will merge this PR :rocket: