(t *testing.T)
| 669 | } |
| 670 | |
| 671 | func TestAuthConfigMerge(t *testing.T) { |
| 672 | content := ` |
| 673 | apiVersion: v1 |
| 674 | clusters: |
| 675 | - cluster: |
| 676 | server: https://localhost:8080 |
| 677 | name: foo-cluster |
| 678 | contexts: |
| 679 | - context: |
| 680 | cluster: foo-cluster |
| 681 | user: foo-user |
| 682 | namespace: bar |
| 683 | name: foo-context |
| 684 | current-context: foo-context |
| 685 | kind: Config |
| 686 | users: |
| 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 | } |
nothing calls this directly
no test coverage detected