openebs/openebsctl

Add unit tests functions in pkg/volume/local_hostpath.go

vharsh opened this issue · 2 comments

There're two functions in this file which do not have unit tests unlike other similar files in the same package, it'd be good to add some unit tests like there are for LocalPV-zfs currently.

Pre-requisites:

  1. Basic working knowledge of Golang, Go Tour is a great place to start
  2. Basic idea of unit-testing, from some blogs and tutorials such as this one
  3. An idea of how tests are written in similar files for other storage engines and how they use the k8s' fake-client to sort of 'mock' the K8s-APIserver. There are really cool blogs about writing unit tests for programs consuming k8s API via client-go, do check them out.

Guidelines:

  1. Try to achieve 100% path coverage in the two functions.
  2. There has been no need of https://github.com/stretchr/testify in the library.
  3. If you face some problems do drop a question in the GitHub issue or in #openebs-dev in the Kubernetes Slack channel.

I'd like to work on this one

Opened this PR