diff --git a/libmachine/versioncmp/compare.go b/libmachine/versioncmp/compare.go index 1465d0fd88..83c9a63ac4 100644 --- a/libmachine/versioncmp/compare.go +++ b/libmachine/versioncmp/compare.go @@ -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. diff --git a/libmachine/versioncmp/compare_test.go b/libmachine/versioncmp/compare_test.go index d1ae83706b..1840aacfca 100644 --- a/libmachine/versioncmp/compare_test.go +++ b/libmachine/versioncmp/compare_test.go @@ -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 {