feat:strict compliance with semverv2 for chart/v3/linter

Signed-off-by: Kamil Swiechowski <kamil.swiechowski@iprally.com>
pull/31064/head
Kamil Swiechowski 2 weeks ago
parent 38d1a7376f
commit cd76ae1c93

@ -60,7 +60,7 @@ func TestBadChartV3(t *testing.T) {
}
}
if msg.Severity == support.ErrorSev {
if strings.Contains(msg.Err.Error(), "version '0.0.0.0' is not a valid SemVer") {
if strings.Contains(msg.Err.Error(), "version '0.0.0.0' is not a valid SemVerV2") {
e = true
}
if strings.Contains(msg.Err.Error(), "name is required") {

@ -140,9 +140,9 @@ func validateChartVersion(cf *chart.Metadata) error {
return errors.New("version is required")
}
version, err := semver.NewVersion(cf.Version)
version, err := semver.StrictNewVersion(cf.Version)
if err != nil {
return fmt.Errorf("version '%s' is not a valid SemVer", cf.Version)
return fmt.Errorf("version '%s' is not a valid SemVerV2", cf.Version)
}
c, err := semver.NewConstraint(">0.0.0-0")

@ -84,9 +84,11 @@ func TestValidateChartVersion(t *testing.T) {
ErrorMsg string
}{
{"", "version is required"},
{"1.2.3.4", "version '1.2.3.4' is not a valid SemVer"},
{"waps", "'waps' is not a valid SemVer"},
{"-3", "'-3' is not a valid SemVer"},
{"1.2.3.4", "version '1.2.3.4' is not a valid SemVerV2"},
{"waps", "'waps' is not a valid SemVerV2"},
{"-3", "'-3' is not a valid SemVerV2"},
{"1.1", "'1.1' is not a valid SemVerV2"},
{"1", "'1' is not a valid SemVerV2"},
}
var successTest = []string{"0.0.1", "0.0.1+build", "0.0.1-beta"}

Loading…
Cancel
Save