forked from helmfile/helmfile
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat add cascade support (helmfile#860)
* feat: add cascade support for helm v3.12.0 Signed-off-by: yxxhero <[email protected]>
- Loading branch information
Showing
19 changed files
with
188 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package state | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/helmfile/helmfile/pkg/helmexec" | ||
"github.com/helmfile/helmfile/pkg/testutil" | ||
) | ||
|
||
func TestAppendCascadeFlags(t *testing.T) { | ||
type args struct { | ||
flags []string | ||
release *ReleaseSpec | ||
cascade string | ||
helm helmexec.Interface | ||
helmSpec HelmSpec | ||
expected []string | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
}{ | ||
{ | ||
name: "no cascade when helm less than 3.11.0", | ||
args: args{ | ||
flags: []string{}, | ||
release: &ReleaseSpec{}, | ||
cascade: "background", | ||
helm: testutil.NewVersionHelmExec("3.11.0"), | ||
expected: []string{}, | ||
}, | ||
}, | ||
{ | ||
name: "cascade from release", | ||
args: args{ | ||
flags: []string{}, | ||
release: &ReleaseSpec{Cascade: &[]string{"background", "background"}[0]}, | ||
cascade: "", | ||
helm: testutil.NewVersionHelmExec("3.12.0"), | ||
expected: []string{"--cascade", "background"}, | ||
}, | ||
}, | ||
{ | ||
name: "cascade from cmd flag", | ||
args: args{ | ||
flags: []string{}, | ||
release: &ReleaseSpec{}, | ||
cascade: "background", | ||
helm: testutil.NewVersionHelmExec("3.12.0"), | ||
expected: []string{"--cascade", "background"}, | ||
}, | ||
}, | ||
{ | ||
name: "cascade from helm defaults", | ||
args: args{ | ||
flags: []string{}, | ||
release: &ReleaseSpec{}, | ||
helmSpec: HelmSpec{Cascade: &[]string{"background", "background"}[0]}, | ||
cascade: "", | ||
helm: testutil.NewVersionHelmExec("3.12.0"), | ||
expected: []string{"--cascade", "background"}, | ||
}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
st := &HelmState{} | ||
st.HelmDefaults = tt.args.helmSpec | ||
got := st.appendCascadeFlags(tt.args.flags, tt.args.helm, tt.args.release, tt.args.cascade) | ||
require.Equalf(t, tt.args.expected, got, "appendCascadeFlags() = %v, want %v", got, tt.args.expected) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.