fixed version check when local is greater than pilosa.com

This commit is contained in:
Michael Baird 2017-11-15 13:07:51 -06:00
parent fbd5f1626d
commit 09a4a72720
2 changed files with 7 additions and 2 deletions

View file

@ -172,9 +172,9 @@ func (d *Diagnostics) CompareVersion(value string) error {
if localVersion[0] < currentVersion[0] { //Major
return fmt.Errorf("Warning: You are running Pilosa %s. A newer version (%s) is available: https://github.com/pilosa/pilosa/releases", d.version, value)
} else if localVersion[1] < currentVersion[1] { // Minor
} else if localVersion[1] < currentVersion[1] && localVersion[0] == currentVersion[0] { // Minor
return fmt.Errorf("Warning: You are running Pilosa %s. The latest Minor release is %s: https://github.com/pilosa/pilosa/releases", d.version, value)
} else if localVersion[2] < currentVersion[2] { // Patch
} else if localVersion[2] < currentVersion[2] && localVersion[0] == currentVersion[0] && localVersion[1] == currentVersion[1] { // Patch
return fmt.Errorf("There is a new patch release of Pilosa available: %s: https://github.com/pilosa/pilosa/releases", value)
}

View file

@ -96,6 +96,11 @@ func TestDiagnosticsVersion_Compare(t *testing.T) {
if err != nil {
t.Fatalf("Versions should match")
}
d.SetVersion("v1.7.0")
err = d.CompareVersion("0.7.2")
if err != nil {
t.Fatalf("Local version is greater")
}
}
func TestDiagnosticsVersion_Check(t *testing.T) {