Test error cases and increase coverage
IbraheemAlSaady opened this issue · 0 comments
IbraheemAlSaady commented
Proper testing for error handling on client sets needs to be added.
We can leverage the Fake
library which is already being used. Here is an example for simulating a failure in creating a service account
import (
fakecorev1 "k8s.io/client-go/kubernetes/typed/core/v1/fake"
)
....
kube.ClientSet.CoreV1().(*fakecorev1.FakeCoreV1).PrependReactor("create", "serviceaccounts", func(action testing.Action) (handled bool, ret runtime.Object, err error) {
return true, &v1.ServiceAccount{}, errors.New("Error creating service account")
})
Unit tests needs to be adjusted to create additional workflows with error