fix(#510): fix golangci-lint run error,add the unit test, add the compatibility when there is blank in the args values.

Signed-off-by: guofutan <guofutan@tencent.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
guofutan
2022-12-13 13:12:07 +08:00
committed by yxxhero
parent 7be64f29cf
commit 4cc07daced
2 changed files with 36 additions and 9 deletions
+23
View File
@@ -69,6 +69,29 @@ func Test_SetExtraArgs(t *testing.T) {
if !reflect.DeepEqual(helm.extra, []string{"alpha", "beta"}) {
t.Error("helmexec.SetExtraArgs() - two extra arguments missing (overwriting the previous value)")
}
helm.SetExtraArgs("--post-renderer=aaa")
fmt.Println(helm.postRenderers)
if !reflect.DeepEqual(helm.postRenderers, []string{"--post-renderer=aaa"}) {
t.Error("helmexec.SetExtraArgs() - post-renderer assign arguments missing ")
}
helm.SetExtraArgs("--post-renderer", "aaa")
fmt.Println(helm.postRenderers)
if !reflect.DeepEqual(helm.postRenderers, []string{"--post-renderer", "aaa"}) {
t.Error("helmexec.SetExtraArgs() - post-renderer blank arguments missing ")
}
helm.SetExtraArgs("--post-renderer-args=bbb")
fmt.Println(helm.postRenderers)
if !reflect.DeepEqual(helm.postRenderers, []string{"--post-renderer-args=bbb"}) {
t.Error("helmexec.SetExtraArgs() - post-renderer-args assign arguments missing")
}
helm.SetExtraArgs("--post-renderer", "aaa", "--post-renderer-args=bbb")
if !reflect.DeepEqual(helm.postRenderers, []string{"--post-renderer", "aaa", "--post-renderer-args=bbb"}) {
t.Error("helmexec.SetExtraArgs() - post-renderer arguments not be set correct")
}
}
func Test_SetHelmBinary(t *testing.T) {