mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-19 10:19:05 +02:00
Fix parseHelmVersion to handle helm versions without 'v' prefix (#2132)
* Initial plan * Fix panic in helmfile init when parsing invalid helm versions Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com> * Fix parseHelmVersion to handle versions without v prefix Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com> * Simplify parseHelmVersion function to be more readable Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
This commit is contained in:
@@ -1140,6 +1140,24 @@ func TestParseHelmVersion(t *testing.T) {
|
||||
want: nil,
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "version without v prefix",
|
||||
version: "3.2.4",
|
||||
want: semver.MustParse("v3.2.4"),
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "version without v prefix with build info",
|
||||
version: "3.2.4+ge29ce2a",
|
||||
want: semver.MustParse("v3.2.4+ge29ce2a"),
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "version without v prefix with spaces",
|
||||
version: " 3.2.4 ",
|
||||
want: semver.MustParse("v3.2.4"),
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user