1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-16 05:16:08 +02:00

fortify: fix semver for pip (#2104)

This commit is contained in:
Oliver Nocon 2020-10-01 14:47:08 +02:00 committed by GitHub
parent b506235398
commit 911a88bd49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -13,7 +13,7 @@ const (
// SchemeMajorMinorVersion is the versioning scheme based on the major version only
SchemeMajorMinorVersion = `{{(split "." (split "-" .Version)._0)._0}}.{{(split "." (split "-" .Version)._0)._1}}`
// SchemeSemanticVersion is the versioning scheme based on the major.minor.micro version
SchemeSemanticVersion = `{{(split "-" .Version)._0}}`
SchemeSemanticVersion = `{{(split "." (split "-" .Version)._0)._0}}.{{(split "." (split "-" .Version)._0)._1}}.{{(split "." (split "-" .Version)._0)._2}}`
// SchemeFullVersion is the versioning scheme based on the full version
SchemeFullVersion = "{{.Version}}"
)

View File

@ -1,8 +1,9 @@
package versioning
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
type mavenMock struct {
@ -89,4 +90,11 @@ func TestDetermineProjectCoordinates(t *testing.T) {
assert.Equal(t, "python-test", name, "Expected different project name")
assert.Equal(t, "2", version, "Expected different project version")
})
t.Run("python semantic", func(t *testing.T) {
gav, _ := (&pipMock{artifactID: "python-test", version: "2.2.3.20200101"}).GetCoordinates()
name, version := DetermineProjectCoordinates(nameTemplate, "semantic", gav)
assert.Equal(t, "python-test", name, "Expected different project name")
assert.Equal(t, "2.2.3", version, "Expected different project version")
})
}