Merge pull request #2001 from influxdb/measurement-not-found-II

Ensure measurement not found returns status code 200
pull/1982/merge
Todd Persen 2015-03-18 11:21:41 -07:00
commit f644ba2e7e
3 changed files with 10 additions and 1 deletions

View File

@ -2,6 +2,9 @@
### Features
- [#2000](https://github.com/influxdb/influxdb/pull/2000): Log broker path when broker fails to start. Thanks @gst.
### Bugfixes
- [#2001](https://github.com/influxdb/influxdb/pull/2001): Ensure measurement not found returns status code 200.
## v0.9.0-rc14 [2015-03-18]
### Bugfixes

View File

@ -441,7 +441,7 @@ func isAuthorizationError(err error) bool {
func isMeasurementNotFoundError(err error) bool {
s := err.Error()
return strings.HasPrefix(s, "measurement") && strings.HasSuffix(s, "not found")
return strings.HasPrefix(s, "measurement") && strings.HasSuffix(s, "not found") || strings.Contains(s, "measurement not found")
}
func isFieldNotFoundError(err error) bool {

View File

@ -153,6 +153,12 @@ func TestHandler_ShowMeasurementsNotFound(t *testing.T) {
} else if body != `{"results":[{"error":"measurement \"bin\" not found"}]}` {
t.Fatalf("unexpected body: %s", body)
}
status, body = MustHTTP("GET", s.URL+`/query`, map[string]string{"q": "SELECT * FROM bin", "db": "foo"}, nil, "")
if status != http.StatusOK {
t.Fatalf("unexpected status: %d", status)
} else if body != `{"results":[{"error":"measurement not found: \"foo\".\"bar\".\"bin\""}]}` {
t.Fatalf("unexpected body: %s", body)
}
}
func TestHandler_Databases(t *testing.T) {