internal/controller/issuerconfig: add missing invalid kubeconfig test?
Signed-off-by: Andrew Keesler <akeesler@vmware.com>
This commit is contained in:
parent
d240796110
commit
8ddc1a1e92
@ -94,7 +94,11 @@ func (c *publisherController) Sync(ctx controller.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
config, _ := clientcmd.Load([]byte(kubeConfig))
|
config, err := clientcmd.Load([]byte(kubeConfig))
|
||||||
|
if err != nil {
|
||||||
|
klog.InfoS("could not load kubeconfig configmap key")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var certificateAuthorityData, server string
|
var certificateAuthorityData, server string
|
||||||
for _, v := range config.Clusters {
|
for _, v := range config.Clusters {
|
||||||
|
@ -436,6 +436,26 @@ func TestSync(t *testing.T) {
|
|||||||
r.Empty(pinnipedAPIClient.Actions())
|
r.Empty(pinnipedAPIClient.Actions())
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
when("the ConfigMap does not have a valid kubeconfig", func() {
|
||||||
|
it.Before(func() {
|
||||||
|
clusterInfoConfigMap := &corev1.ConfigMap{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{Name: "cluster-info", Namespace: "kube-public"},
|
||||||
|
Data: map[string]string{
|
||||||
|
"kubeconfig": "this is an invalid kubeconfig",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
err := kubeInformerClient.Tracker().Add(clusterInfoConfigMap)
|
||||||
|
r.NoError(err)
|
||||||
|
})
|
||||||
|
|
||||||
|
it("keeps waiting for it to be properly formatted", func() {
|
||||||
|
startInformersAndController()
|
||||||
|
err := controller.TestSync(t, subject, *syncContext)
|
||||||
|
r.NoError(err)
|
||||||
|
r.Empty(pinnipedAPIClient.Actions())
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
when("there is not a cluster-info ConfigMap in the kube-public namespace", func() {
|
when("there is not a cluster-info ConfigMap in the kube-public namespace", func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user