improvements to the version check message

This commit is contained in:
Michael Baird 2017-11-01 11:59:59 -05:00
parent 030b0721c8
commit 98bd7b3ba2
2 changed files with 8 additions and 8 deletions

View file

@ -126,7 +126,7 @@ func (d *Diagnostics) Open() {
}
d.cb = gobreaker.NewCircuitBreaker(st)
d.logger().Printf("Pilosa is currently configured to send small diagnostics reports to our team every hour. More information here: https://www.pilosa.com/docs/latest/administration/")
d.logger().Printf("Pilosa is currently configured to send small diagnostics reports to our team every hour. More information here: https://www.pilosa.com/docs/latest/administration/#diagnostics")
}
// Close notify goroutine to stop.
@ -171,11 +171,11 @@ func (d *Diagnostics) CompareVersion(value string) error {
localVersion := VersionSegments(d.version)
if localVersion[0] < currentVersion[0] { //Major
return fmt.Errorf("Warning: You are running Pilosa %s, but a newer version is available %s", d.version, value)
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
return fmt.Errorf("Warning: You are running Pilosa %s. The latest Minor release is %s", d.version, value)
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
return fmt.Errorf("There is a new patch relese of Pilosa availbale: %s", value)
return fmt.Errorf("There is a new patch release of Pilosa availbale: %s: https://github.com/pilosa/pilosa/releases", value)
}
return nil

View file

@ -76,12 +76,12 @@ func TestDiagnosticsVersion_Compare(t *testing.T) {
version := "v0.1.1"
d.SetVersion(version)
err := d.CompareVersion("1.7.0")
if !strings.Contains(err.Error(), "a newer version is available ") {
err := d.CompareVersion("v1.7.0")
if !strings.Contains(err.Error(), "A newer version") {
t.Fatalf("Expected a newer version is available, actual error: %s", err)
}
err = d.CompareVersion("1.7.0")
if !strings.Contains(err.Error(), "a newer version is available ") {
if !strings.Contains(err.Error(), "A newer version") {
t.Fatalf("Expected a newer version is available, actual error: %s", err)
}
err = d.CompareVersion("0.7.0")
@ -89,7 +89,7 @@ func TestDiagnosticsVersion_Compare(t *testing.T) {
t.Fatalf("Expected Minor Version Missmatch, actual error: %s", err)
}
err = d.CompareVersion("0.1.2")
if !strings.Contains(err.Error(), "There is a new patch relese of Pilosa") {
if !strings.Contains(err.Error(), "There is a new patch release of Pilosa") {
t.Fatalf("Expected Patch Version Missmatch, actual error: %s", err)
}
err = d.CompareVersion("0.1.1")