vmware-archive / kops

Kubernetes Operations (kops) - Production Grade K8s Installation, Upgrades, and Management
Apache License 2.0
3 stars 3 forks source link

Add unit tests #37

Open abrarshivani opened 7 years ago

abrarshivani commented 7 years ago

Add unit tests so that issues can be captured in make ci

luomiao commented 7 years ago

Unit tests should be added for new vSphere functionalities/tasks/code. Usually the unit tests simply reside together with the code need to be tested. For example, https://github.com/kubernetes/kops/blob/master/upup/pkg/fi/cloudup/awsup/aws_utils.go has its corresponding tests at: https://github.com/kubernetes/kops/blob/master/upup/pkg/fi/cloudup/awsup/aws_utils_test.go

Similarly, vSphere's utility code at: https://github.com/kubernetes/kops/blob/master/upup/pkg/fi/cloudup/vsphere/vsphere_utils.go may have its tests vsphere_utils_test.go at the same folder.

Guideline for unit tests: (I am just borrowing from kubernetes' unit tests guide)

We may not need unit tests for every file at once. But we should have the unit tests for significant files first. Current vSphere packages and files: pkg/model/vspheremodel/ pkg/resources/delete_cluster_vsphere.go protokube/pkg/protokube/vsphere_volume.go upup/pkg/fi/cloudup/vsphere/ upup/pkg/fi/cloudup/vspheretasks/

pdhamdhere commented 7 years ago

@casualjim We need to put framework in place to easily add and run these unit tests.

fabulous-gopher commented 7 years ago

This issue was moved to kubernetes/kops#2745