Skip to content

Commit

Permalink
Merge pull request docker#4128 from StefanScherer/fix-versioncmp
Browse files Browse the repository at this point in the history
Fix versioncmp for CE edition
  • Loading branch information
FrenchBen authored Jun 30, 2017
2 parents c604d46 + efe0ca5 commit 255980c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libmachine/versioncmp/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions libmachine/versioncmp/compare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 255980c

Please sign in to comment.