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

Function Test_viewMetaFor

internal/view/command_test.go:14–84  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func Test_viewMetaFor(t *testing.T) {
15 uu := map[string]struct {
16 cmd string
17 gvr *client.GVR
18 p *cmd.Interpreter
19 err error
20 }{
21 "empty": {
22 cmd: "",
23 gvr: client.PodGVR,
24 err: errors.New("`` command not found"),
25 },
26
27 "toast": {
28 cmd: "v1/pd",
29 gvr: client.PodGVR,
30 err: errors.New("`v1/pd` command not found"),
31 },
32
33 "gvr": {
34 cmd: "v1/pods",
35 gvr: client.PodGVR,
36 p: cmd.NewInterpreter("v1/pods"),
37 err: errors.New("blah"),
38 },
39
40 "short-name": {
41 cmd: "po",
42 gvr: client.PodGVR,
43 p: cmd.NewInterpreter("v1/pods", "po"),
44 err: errors.New("blee"),
45 },
46
47 "custom-alias": {
48 cmd: "pdl",
49 gvr: client.PodGVR,
50 p: cmd.NewInterpreter("v1/pods @fred 'app=blee' default", "pdl"),
51 err: errors.New("blee"),
52 },
53
54 "inception": {
55 cmd: "pdal blee",
56 gvr: client.PodGVR,
57 p: cmd.NewInterpreter("v1/pods @fred 'app=blee' blee", "pdal", "pod"),
58 err: errors.New("blee"),
59 },
60 }
61
62 c := &Command{
63 alias: &dao.Alias{
64 Aliases: config.NewAliases(),
65 },
66 }
67 c.alias.Define(client.PodGVR, "po", "pod", "pods", client.PodGVR.String())
68 c.alias.Define(client.NewGVR("pod default"), "pd")
69 c.alias.Define(client.NewGVR("pod @fred 'app=blee' default"), "pdl")
70 c.alias.Define(client.NewGVR("pdl"), "pdal")
71

Callers

nothing calls this directly

Calls 8

viewMetaForMethod · 0.95
NewInterpreterFunction · 0.92
NewAliasesFunction · 0.92
NewGVRFunction · 0.92
DefineMethod · 0.80
RunMethod · 0.65
StringMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…