MCPcopy
hub / github.com/derailed/k9s / TestConfigCurrentUser

Function TestConfigCurrentUser

internal/client/config_test.go:112–137  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

110}
111
112func TestConfigCurrentUser(t *testing.T) {
113 name := "blee"
114 uu := map[string]struct {
115 flags *genericclioptions.ConfigFlags
116 user string
117 }{
118 "default": {
119 flags: &genericclioptions.ConfigFlags{KubeConfig: &kubeConfig},
120 user: "fred",
121 },
122 "custom": {
123 flags: &genericclioptions.ConfigFlags{KubeConfig: &kubeConfig, AuthInfoName: &name},
124 user: "blee",
125 },
126 }
127
128 for k := range uu {
129 u := uu[k]
130 t.Run(k, func(t *testing.T) {
131 cfg := client.NewConfig(u.flags)
132 ctx, err := cfg.CurrentUserName()
133 require.NoError(t, err)
134 assert.Equal(t, u.user, ctx)
135 })
136 }
137}
138
139func TestConfigCurrentNamespace(t *testing.T) {
140 bleeNS, bleeCTX := "blee", "blee"

Callers

nothing calls this directly

Calls 3

CurrentUserNameMethod · 0.95
NewConfigFunction · 0.92
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…