fix issues

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero
2024-06-02 15:03:54 +08:00
parent c710e2b01c
commit cc3202e9b9
6 changed files with 7 additions and 14 deletions
+2 -5
View File
@@ -113,11 +113,8 @@ func (st *HelmState) appendDryRunFlags(flags []string, helm helmexec.Interface,
if !helm.IsVersionAtLeast("3.13.0") {
return flags
}
switch {
case opt != nil && opt.DryRun != "":
flags = append(flags, "--dry-run", opt.DryRun)
case opt != nil && opt.DryRun == "":
flags = append(flags, "--dry-run", "client")
if opt != nil && opt.DryRun != "" {
flags = append(flags, fmt.Sprintf("--dry-run=%s", opt.DryRun))
}
return flags
}
+3 -3
View File
@@ -294,7 +294,7 @@ func TestAppendDryRunFlags(t *testing.T) {
flags: []string{},
dryRun: "client",
helm: testutil.NewVersionHelmExec("3.13.0"),
expected: []string{"--dry-run", "client"},
expected: []string{"--dry-run=client"},
},
},
{
@@ -303,7 +303,7 @@ func TestAppendDryRunFlags(t *testing.T) {
flags: []string{},
dryRun: "",
helm: testutil.NewVersionHelmExec("3.13.0"),
expected: []string{"--dry-run", "client"},
expected: []string{},
},
},
{
@@ -312,7 +312,7 @@ func TestAppendDryRunFlags(t *testing.T) {
flags: []string{},
dryRun: "server",
helm: testutil.NewVersionHelmExec("3.13.0"),
expected: []string{"--dry-run", "server"},
expected: []string{"--dry-run=server"},
},
},
{