pull/11781/merge
Graham Reed 1 month ago committed by GitHub
commit 9a8d8c2318
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -162,7 +162,7 @@ func (i HTTPInstaller) Path() string {
if i.Source == "" {
return ""
}
return helmpath.DataPath("plugins", i.PluginName)
return filepath.Join(i.base.PluginsDirectory, i.PluginName)
}
// cleanJoin resolves dest as a subpath of root.

@ -348,3 +348,38 @@ func TestMediaTypeToExtension(t *testing.T) {
}
}
}
func TestHttpInstallerPath(t *testing.T) {
tests := []struct {
source string
pluginName string
helmPluginsDir string
expectPath string
}{
{
source: "",
pluginName: "not-used",
helmPluginsDir: "/helm/data/plugins",
expectPath: "",
}, {
source: "https://github.com/jkroepke/helm-secrets",
pluginName: "helm-http-plugin",
helmPluginsDir: "/helm/data/plugins",
expectPath: "/helm/data/plugins/helm-http-plugin",
},
}
for _, tt := range tests {
os.Setenv("HELM_PLUGINS", tt.helmPluginsDir)
ins := &HTTPInstaller{
PluginName: tt.pluginName,
base: newBase(tt.source),
}
insPath := ins.Path()
if insPath != tt.expectPath {
t.Errorf("expected name %s, got %s", tt.expectPath, insPath)
}
os.Unsetenv("HELM_PLUGINS")
}
}

Loading…
Cancel
Save