openebs / openebsctl

`openebsctl` is a kubectl plugin to manage OpenEBS storage components.
Apache License 2.0
29 stars 21 forks source link

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

Closed vharsh closed 3 years ago

vharsh commented 3 years ago

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.
giovannitgl commented 3 years ago

I'd like to work on this one

giovannitgl commented 3 years ago

Opened this PR