(t *testing.T)
| 238 | } |
| 239 | |
| 240 | func TestCertificateData(t *testing.T) { |
| 241 | caData := []byte("ca-data") |
| 242 | certData := []byte("cert-data") |
| 243 | keyData := []byte("key-data") |
| 244 | |
| 245 | config := clientcmdapi.NewConfig() |
| 246 | config.Clusters["clean"] = &clientcmdapi.Cluster{ |
| 247 | Server: "https://localhost:8443", |
| 248 | CertificateAuthorityData: caData, |
| 249 | } |
| 250 | config.AuthInfos["clean"] = &clientcmdapi.AuthInfo{ |
| 251 | ClientCertificateData: certData, |
| 252 | ClientKeyData: keyData, |
| 253 | } |
| 254 | config.Contexts["clean"] = &clientcmdapi.Context{ |
| 255 | Cluster: "clean", |
| 256 | AuthInfo: "clean", |
| 257 | } |
| 258 | config.CurrentContext = "clean" |
| 259 | |
| 260 | clientBuilder := NewNonInteractiveClientConfig(*config, "clean", &ConfigOverrides{}, nil) |
| 261 | |
| 262 | clientConfig, err := clientBuilder.ClientConfig() |
| 263 | if err != nil { |
| 264 | t.Fatalf("Unexpected error: %v", err) |
| 265 | } |
| 266 | |
| 267 | // Make sure cert data gets into config (will override file paths) |
| 268 | matchByteArg(caData, clientConfig.TLSClientConfig.CAData, t) |
| 269 | matchByteArg(certData, clientConfig.TLSClientConfig.CertData, t) |
| 270 | matchByteArg(keyData, clientConfig.TLSClientConfig.KeyData, t) |
| 271 | } |
| 272 | |
| 273 | func TestBasicAuthData(t *testing.T) { |
| 274 | username := "myuser" |
nothing calls this directly
no test coverage detected