...
1
13
14 package installer
15
16 import (
17 "os"
18 "testing"
19 )
20
21 func TestPath(t *testing.T) {
22 tests := []struct {
23 source string
24 helmPluginsDir string
25 expectPath string
26 }{
27 {
28 source: "",
29 helmPluginsDir: "/helm/data/plugins",
30 expectPath: "",
31 }, {
32 source: "https://github.com/jkroepke/helm-secrets",
33 helmPluginsDir: "/helm/data/plugins",
34 expectPath: "/helm/data/plugins/helm-secrets",
35 },
36 }
37
38 for _, tt := range tests {
39
40 os.Setenv("HELM_PLUGINS", tt.helmPluginsDir)
41 baseIns := newBase(tt.source)
42 baseInsPath := baseIns.Path()
43 if baseInsPath != tt.expectPath {
44 t.Errorf("expected name %s, got %s", tt.expectPath, baseInsPath)
45 }
46 os.Unsetenv("HELM_PLUGINS")
47 }
48 }
49
View as plain text