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

Function TestConfigCurrentContext

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

Source from the content-addressed store, hash-verified

48}
49
50func 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
80func TestConfigCurrentCluster(t *testing.T) {
81 name := "blee"

Callers

nothing calls this directly

Calls 3

CurrentContextNameMethod · 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…