MCPcopy
hub / github.com/helm/helm / TestRootCmd

Function TestRootCmd

pkg/cmd/root_test.go:32–118  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30)
31
32func TestRootCmd(t *testing.T) {
33 defer resetEnv()()
34
35 tests := []struct {
36 name, args, cachePath, configPath, dataPath string
37 envvars map[string]string
38 }{
39 {
40 name: "defaults",
41 args: "env",
42 },
43 {
44 name: "with $XDG_CACHE_HOME set",
45 args: "env",
46 envvars: map[string]string{xdg.CacheHomeEnvVar: "/bar"},
47 cachePath: "/bar/helm",
48 },
49 {
50 name: "with $XDG_CONFIG_HOME set",
51 args: "env",
52 envvars: map[string]string{xdg.ConfigHomeEnvVar: "/bar"},
53 configPath: "/bar/helm",
54 },
55 {
56 name: "with $XDG_DATA_HOME set",
57 args: "env",
58 envvars: map[string]string{xdg.DataHomeEnvVar: "/bar"},
59 dataPath: "/bar/helm",
60 },
61 {
62 name: "with $HELM_CACHE_HOME set",
63 args: "env",
64 envvars: map[string]string{helmpath.CacheHomeEnvVar: "/foo/helm"},
65 cachePath: "/foo/helm",
66 },
67 {
68 name: "with $HELM_CONFIG_HOME set",
69 args: "env",
70 envvars: map[string]string{helmpath.ConfigHomeEnvVar: "/foo/helm"},
71 configPath: "/foo/helm",
72 },
73 {
74 name: "with $HELM_DATA_HOME set",
75 args: "env",
76 envvars: map[string]string{helmpath.DataHomeEnvVar: "/foo/helm"},
77 dataPath: "/foo/helm",
78 },
79 }
80
81 for _, tt := range tests {
82 t.Run(tt.name, func(t *testing.T) {
83 ensure.HelmHome(t)
84
85 for k, v := range tt.envvars {
86 t.Setenv(k, v)
87 }
88
89 if _, _, err := executeActionCommand(tt.args); err != nil {

Callers

nothing calls this directly

Calls 8

HelmHomeFunction · 0.92
CachePathFunction · 0.92
ConfigPathFunction · 0.92
DataPathFunction · 0.92
executeActionCommandFunction · 0.85
FatalfMethod · 0.80
resetEnvFunction · 0.70
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…