I am writing the simplest fxn possible using client-go
that justs performs in-cluster authentication and returns a pointer to the kubernetes.Clientset
object
// getInClusterAuth performs in cluster authentication and returns the clientset
func getInClusterAuth() (*kubernetes.Clientset, error) {
// creates the in-cluster config
config, err := rest.InClusterConfig()
if err != nil {
return nil, err
}
// create the clientset
clientset, err := kubernetes.NewForConfig(config)
if err != nil {
return nil, err
}
return clientset, nil
}
Since this is sth that not only does it run against an external system (a k8s
api server) but it is also supposed to be running from within a Pod
once deployed, what is the appropriate way of unit-testing it?
Could it be that it is an acceptable practice to cover the case in e2e or integration tests?