Add the option to specify an alternative helm binary (#181)

`helm` may not be version compatible. Add an option to specify an alternative `helm` command on runtime, possibly according to the version of tiller running on your cluster.
This commit is contained in:
Hori Ryota
2018-07-03 22:19:02 +09:00
committed by KUOKA Yusuke
parent 88e84e5ae8
commit 9f57f8be7d
5 changed files with 57 additions and 2 deletions
+20
View File
@@ -56,6 +56,17 @@ func Test_SetExtraArgs(t *testing.T) {
}
}
func Test_SetHelmBinary(t *testing.T) {
helm := New(new(bytes.Buffer), "dev")
if helm.helmBinary != "helm" {
t.Error("helmexec.command - default command is not helm")
}
helm.SetHelmBinary("foo")
if helm.helmBinary != "foo" {
t.Errorf("helmexec.SetHelmBinary() - actual = %s expect = foo", helm.helmBinary)
}
}
func Test_AddRepo(t *testing.T) {
var buffer bytes.Buffer
helm := MockExecer(&buffer, "dev")
@@ -237,6 +248,15 @@ func Test_exec(t *testing.T) {
if buffer.String() != expected {
t.Errorf("helmexec.exec()\nactual = %v\nexpect = %v", buffer.String(), expected)
}
buffer.Reset()
helm = MockExecer(&buffer, "")
helm.SetHelmBinary("overwritten")
helm.exec("version")
expected = "exec: overwritten version\n"
if buffer.String() != expected {
t.Errorf("helmexec.exec()\nactual = %v\nexpect = %v", buffer.String(), expected)
}
}
func Test_Lint(t *testing.T) {