Fix versioncmp for ce edition
Signed-off-by: Stefan Scherer <scherer_stefan@icloud.com>
This commit is contained in:
@@ -29,10 +29,10 @@ func compare(v1, v2 string) int {
|
||||
// presence of the "ce" string in the version string) are "less than"
|
||||
// any community edition release (first occuring in March 2017).
|
||||
if strings.Contains(v1, ceEdition) && !strings.Contains(v2, ceEdition) {
|
||||
return -1
|
||||
return 1
|
||||
}
|
||||
if !strings.Contains(v1, ceEdition) && strings.Contains(v2, ceEdition) {
|
||||
return 1
|
||||
return -1
|
||||
}
|
||||
|
||||
// Without this tag, both are pre-CE versions.
|
||||
|
||||
@@ -33,6 +33,8 @@ func TestCompare(t *testing.T) {
|
||||
{"17.03.0-ce", "17.06.0-ce", -1},
|
||||
{"17.03.0-ce-rc2", "17.03.0-ce-rc1", 1},
|
||||
{"17.03.0-ce-rc1", "18.03.0-ce-rc1", -1},
|
||||
{"17.06.0-ce-rc2", "1.12.0", 1},
|
||||
{"1.12.0", "17.06.0-ce-rc2", -1},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
|
||||
Reference in New Issue
Block a user