(t *testing.T)
| 390 | } |
| 391 | |
| 392 | func TestCreateCleanWithPrefix(t *testing.T) { |
| 393 | tt := []struct { |
| 394 | server string |
| 395 | host string |
| 396 | }{ |
| 397 | {"https://anything.com:8080/foo/bar", "https://anything.com:8080/foo/bar"}, |
| 398 | {"http://anything.com:8080/foo/bar", "http://anything.com:8080/foo/bar"}, |
| 399 | {"http://anything.com:8080/foo/bar/", "http://anything.com:8080/foo/bar/"}, |
| 400 | {"http://anything.com:8080/", "http://anything.com:8080/"}, |
| 401 | {"http://anything.com:8080//", "http://anything.com:8080//"}, |
| 402 | {"anything.com:8080/foo/bar", "anything.com:8080/foo/bar"}, |
| 403 | {"anything.com:8080", "anything.com:8080"}, |
| 404 | {"anything.com", "anything.com"}, |
| 405 | {"anything", "anything"}, |
| 406 | } |
| 407 | |
| 408 | tt = append(tt, struct{ server, host string }{"", "http://localhost:8080"}) |
| 409 | |
| 410 | for _, tc := range tt { |
| 411 | config := createValidTestConfig() |
| 412 | |
| 413 | cleanConfig := config.Clusters["clean"] |
| 414 | cleanConfig.Server = tc.server |
| 415 | config.Clusters["clean"] = cleanConfig |
| 416 | |
| 417 | clientBuilder := NewNonInteractiveClientConfig(*config, "clean", &ConfigOverrides{ |
| 418 | ClusterDefaults: clientcmdapi.Cluster{Server: "http://localhost:8080"}, |
| 419 | }, nil) |
| 420 | |
| 421 | clientConfig, err := clientBuilder.ClientConfig() |
| 422 | if err != nil { |
| 423 | t.Fatalf("Unexpected error: %v", err) |
| 424 | } |
| 425 | |
| 426 | matchStringArg(tc.host, clientConfig.Host, t) |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | func TestCreateCleanDefault(t *testing.T) { |
| 431 | config := createValidTestConfig() |
nothing calls this directly
no test coverage detected