func (s *upgradeSuite) TestUpgradeOperationsOrdered(c *gc.C) { var previous version.Number for i, utv := range (*upgrades.UpgradeOperations)() { vers := utv.TargetVersion() if i > 0 { c.Check(previous.Compare(vers), gc.Equals, -1) } previous = vers } }
// Newest returns the greatest version in src, and the tools with that version. func (src List) Newest() (version.Number, List) { var result List var best version.Number for _, tools := range src { if best.Compare(tools.Version.Number) < 0 { // Found new best number; reset result list. best = tools.Version.Number result = append(result[:0], tools) } else if tools.Version.Number == best { result = append(result, tools) } } return best, result }
func isPreHAVersion(v version.Number) bool { return v.Compare(version.MustParse("1.19.0")) < 0 }
func isCompatibleVersion(v1, v2 version.Number) bool { v1.Build = 0 v2.Build = 0 return v1.Compare(v2) == 0 }