(t *testing.T)
| 48 | } |
| 49 | |
| 50 | func TestConfigCurrentContext(t *testing.T) { |
| 51 | uu := map[string]struct { |
| 52 | context string |
| 53 | e string |
| 54 | }{ |
| 55 | "default": { |
| 56 | e: "fred", |
| 57 | }, |
| 58 | "custom": { |
| 59 | context: "blee", |
| 60 | e: "blee", |
| 61 | }, |
| 62 | } |
| 63 | |
| 64 | for k := range uu { |
| 65 | u := uu[k] |
| 66 | t.Run(k, func(t *testing.T) { |
| 67 | flags := genericclioptions.NewConfigFlags(false) |
| 68 | flags.KubeConfig = &kubeConfig |
| 69 | if u.context != "" { |
| 70 | flags.Context = &u.context |
| 71 | } |
| 72 | cfg := client.NewConfig(flags) |
| 73 | ctx, err := cfg.CurrentContextName() |
| 74 | require.NoError(t, err) |
| 75 | assert.Equal(t, u.e, ctx) |
| 76 | }) |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | func TestConfigCurrentCluster(t *testing.T) { |
| 81 | name := "blee" |
nothing calls this directly
no test coverage detected
searching dependent graphs…