Allocate map when out points to nil map

Kubernetes-commit: 53080bda9c95db33227b02b5b7df7e7737a2904e
This commit is contained in:
Ted Yu
2019-12-18 14:17:48 -08:00
committed by Kubernetes Publisher
parent a32a6f7a30
commit efe42e9182
2 changed files with 38 additions and 0 deletions

View File

@@ -80,6 +80,32 @@ var (
}
)
func TestNilOutMap(t *testing.T) {
var fakeKubeconfigData = `apiVersion: v1
kind: Config
clusters:
- cluster:
certificate-authority-data: UEhPTlkK
server: https://1.1.1.1
name: production
contexts:
- context:
cluster: production
user: production
name: production
current-context: production
users:
- name: production
user:
auth-provider:
name: gcp`
_, _, err := clientcmdlatest.Codec.Decode([]byte(fakeKubeconfigData), nil, nil)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
}
func TestNonExistentCommandLineFile(t *testing.T) {
loadingRules := ClientConfigLoadingRules{
ExplicitPath: "bogus_file",