test: add test cases for force flag from defaults with nil release
Add test cases to cover the scenario where release.Force is nil and HelmDefaults.Force enables force for both Helm 3 and Helm 4. Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
parent
abcef80d39
commit
03aac8ec78
|
|
@ -338,6 +338,44 @@ func TestHelmState_flagsForUpgrade(t *testing.T) {
|
|||
"--namespace", "test-namespace",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "force-from-default-nil-release-helm3",
|
||||
defaults: HelmSpec{
|
||||
Force: true,
|
||||
CreateNamespace: &disable,
|
||||
},
|
||||
version: semver.MustParse("3.10.0"),
|
||||
release: &ReleaseSpec{
|
||||
Chart: "test/chart",
|
||||
Version: "0.1",
|
||||
Name: "test-charts",
|
||||
Namespace: "test-namespace",
|
||||
},
|
||||
want: []string{
|
||||
"--version", "0.1",
|
||||
"--force",
|
||||
"--namespace", "test-namespace",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "force-from-default-nil-release-helm4",
|
||||
defaults: HelmSpec{
|
||||
Force: true,
|
||||
CreateNamespace: &disable,
|
||||
},
|
||||
version: semver.MustParse("4.0.0"),
|
||||
release: &ReleaseSpec{
|
||||
Chart: "test/chart",
|
||||
Version: "0.1",
|
||||
Name: "test-charts",
|
||||
Namespace: "test-namespace",
|
||||
},
|
||||
want: []string{
|
||||
"--version", "0.1",
|
||||
"--force-replace",
|
||||
"--namespace", "test-namespace",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "recreate-pods",
|
||||
defaults: HelmSpec{
|
||||
|
|
|
|||
Loading…
Reference in New Issue