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

Function TestAuthConfigMerge

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

Source from the content-addressed store, hash-verified

669}
670
671func TestAuthConfigMerge(t *testing.T) {
672 content := `
673apiVersion: v1
674clusters:
675- cluster:
676 server: https://localhost:8080
677 name: foo-cluster
678contexts:
679- context:
680 cluster: foo-cluster
681 user: foo-user
682 namespace: bar
683 name: foo-context
684current-context: foo-context
685kind: Config
686users:
687- name: foo-user
688 user:
689 exec:
690 apiVersion: client.authentication.k8s.io/v1alpha1
691 args:
692 - arg-1
693 - arg-2
694 command: foo-command
695`
696 tmpfile, err := ioutil.TempFile("", "kubeconfig")
697 if err != nil {
698 t.Error(err)
699 }
700 defer os.Remove(tmpfile.Name())
701 if err := ioutil.WriteFile(tmpfile.Name(), []byte(content), 0666); err != nil {
702 t.Error(err)
703 }
704 config, err := BuildConfigFromFlags("", tmpfile.Name())
705 if err != nil {
706 t.Error(err)
707 }
708 if !reflect.DeepEqual(config.ExecProvider.Args, []string{"arg-1", "arg-2"}) {
709 t.Errorf("Got args %v when they should be %v\n", config.ExecProvider.Args, []string{"arg-1", "arg-2"})
710 }
711
712}

Callers

nothing calls this directly

Calls 4

BuildConfigFromFlagsFunction · 0.85
ErrorMethod · 0.65
ErrorfMethod · 0.65
NameMethod · 0.45

Tested by

no test coverage detected