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