(t *testing.T)
| 30 | ) |
| 31 | |
| 32 | func 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 { |
nothing calls this directly
no test coverage detected
searching dependent graphs…