MCPcopy
hub / github.com/kubernetes/client-go / TestCreateCleanWithPrefix

Function TestCreateCleanWithPrefix

tools/clientcmd/client_config_test.go:392–428  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

390}
391
392func 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
430func TestCreateCleanDefault(t *testing.T) {
431 config := createValidTestConfig()

Callers

nothing calls this directly

Calls 4

createValidTestConfigFunction · 0.85
matchStringArgFunction · 0.85
ClientConfigMethod · 0.65

Tested by

no test coverage detected