diff --git a/cmd/influxd/server_integration_test.go b/cmd/influxd/server_integration_test.go index c9bd2ab3b3..d5a4d7caaa 100644 --- a/cmd/influxd/server_integration_test.go +++ b/cmd/influxd/server_integration_test.go @@ -221,9 +221,9 @@ func write(t *testing.T, node *TestNode, data string) { if string(body) != "" { t.Log("BODY: ", string(body)) } - if resp.StatusCode != http.StatusOK { + if resp.StatusCode != http.StatusNoContent { body, _ := ioutil.ReadAll(resp.Body) - t.Fatalf("Write to database failed. Unexpected status code. expected: %d, actual %d, %s", http.StatusOK, resp.StatusCode, string(body)) + t.Fatalf("Write to database failed. Unexpected status code. expected: %d, actual %d, %s", http.StatusNoContent, resp.StatusCode, string(body)) } } @@ -617,24 +617,24 @@ func runTestsData(t *testing.T, testName string, nodes Cluster, database, retent queryDb: "%DB%", expected: `{"results":[{"series":[{"name":"cpu","columns":["time","mean","stddev"],"values":[["2000-01-01T00:00:00Z",5,2.138089935299395]]}]}]}`, }, - { - reset: false, - name: "first value", - query: `SELECT FIRST(value) FROM cpu`, + { + reset: false, + name: "first value", + query: `SELECT FIRST(value) FROM cpu`, queryDb: "%DB%", expected: `{"results":[{"series":[{"name":"cpu","columns":["time","first"],"values":[["1970-01-01T00:00:00Z",2]]}]}]}`, }, { - reset: false, - name: "last value", - query: `SELECT LAST(value) FROM cpu`, + reset: false, + name: "last value", + query: `SELECT LAST(value) FROM cpu`, queryDb: "%DB%", expected: `{"results":[{"series":[{"name":"cpu","columns":["time","last"],"values":[["1970-01-01T00:00:00Z",9]]}]}]}`, }, { - reset: false, - name: "value spread", - query: `SELECT SPREAD(value) FROM cpu`, + reset: false, + name: "value spread", + query: `SELECT SPREAD(value) FROM cpu`, queryDb: "%DB%", expected: `{"results":[{"series":[{"name":"cpu","columns":["time","spread"],"values":[["1970-01-01T00:00:00Z",7]]}]}]}`, }, diff --git a/httpd/handler_test.go b/httpd/handler_test.go index 293a413180..13fee0604a 100644 --- a/httpd/handler_test.go +++ b/httpd/handler_test.go @@ -174,7 +174,7 @@ func TestHandler_SelectTagNotFound(t *testing.T) { // Write some data status, _ := MustHTTP("POST", s.URL+`/write`, nil, nil, `{"database" : "foo", "retentionPolicy" : "default", "points": [{"name": "bin", "tags": {"host": "server01"},"time": "2009-11-10T23:00:00Z","fields": {"value": 100}}]}`) - if status != http.StatusOK { + if status != http.StatusNoContent { t.Fatalf("unexpected status: %d", status) } @@ -1098,7 +1098,7 @@ func TestHandler_DropSeries(t *testing.T) { status, _ := MustHTTP("POST", s.URL+`/write`, nil, nil, `{"database" : "foo", "retentionPolicy" : "bar", "points": [{"name": "cpu", "tags": {"host": "server01"},"time": "2009-11-10T23:00:00Z","fields": {"value": 100}}]}`) - if status != http.StatusOK { + if status != http.StatusNoContent { t.Fatalf("unexpected status: %d", status) } @@ -1120,7 +1120,7 @@ func TestHandler_serveWriteSeries(t *testing.T) { status, _ := MustHTTP("POST", s.URL+`/write`, nil, nil, `{"database" : "foo", "retentionPolicy" : "default", "points": [{"name": "cpu", "tags": {"host": "server01"},"time": "2009-11-10T23:00:00Z","fields": {"value": 100}}]}`) - if status != http.StatusOK { + if status != http.StatusNoContent { t.Fatalf("unexpected status for post: %d", status) } query := map[string]string{"db": "foo", "q": "select * from cpu"} @@ -1143,7 +1143,7 @@ func TestHandler_serveDump(t *testing.T) { status, _ := MustHTTP("POST", s.URL+`/write`, nil, nil, `{"database" : "foo", "retentionPolicy" : "default", "points": [{"name": "cpu", "tags": {"host": "server01"},"time": "2009-11-10T23:00:00Z","fields": {"value": 100}}]}`) - if status != http.StatusOK { + if status != http.StatusNoContent { t.Fatalf("unexpected status for post: %d", status) } @@ -1282,7 +1282,7 @@ func TestHandler_serveWriteSeries_queryHasJsonContentType(t *testing.T) { defer s.Close() status, _ := MustHTTP("POST", s.URL+`/write`, nil, nil, `{"database" : "foo", "retentionPolicy" : "bar", "points": [{"name": "cpu", "tags": {"host": "server01"},"time": "2009-11-10T23:00:00Z", "fields": {"value": 100}}]}`) - if status != http.StatusOK { + if status != http.StatusNoContent { t.Fatalf("unexpected status: %d", status) } time.Sleep(100 * time.Millisecond) // Ensure data node picks up write. @@ -1378,7 +1378,7 @@ func TestHandler_serveWriteSeriesNonZeroTime(t *testing.T) { defer s.Close() status, _ := MustHTTP("POST", s.URL+`/write`, nil, nil, `{"database" : "foo", "retentionPolicy" : "bar", "points": [{"name": "cpu", "tags": {"host": "server01"},"time": "2009-11-10T23:00:00Z", "fields": {"value": 100}}]}`) - if status != http.StatusOK { + if status != http.StatusNoContent { t.Fatalf("unexpected status: %d", status) } time.Sleep(100 * time.Millisecond) // Ensure data node picks up write. @@ -1424,7 +1424,7 @@ func TestHandler_serveWriteSeriesZeroTime(t *testing.T) { status, _ := MustHTTP("POST", s.URL+`/write`, nil, nil, `{"database" : "foo", "retentionPolicy" : "bar", "points": [{"name": "cpu", "tags": {"host": "server01"},"fields": {"value": 100}}]}`) - if status != http.StatusOK { + if status != http.StatusNoContent { t.Fatalf("unexpected status: %d", status) } time.Sleep(100 * time.Millisecond) // Ensure data node picks up write. @@ -1514,7 +1514,7 @@ func TestHandler_serveWriteSeriesBatch(t *testing.T) { } ` status, body := MustHTTP("POST", s.URL+`/write`, nil, nil, batch) - if status != http.StatusOK { + if status != http.StatusNoContent { t.Log(body) t.Fatalf("unexpected status: %d", status) } @@ -1561,7 +1561,7 @@ func TestHandler_serveWriteSeriesFieldTypeConflict(t *testing.T) { defer s.Close() status, _ := MustHTTP("POST", s.URL+`/write`, nil, nil, `{"database" : "foo", "retentionPolicy" : "bar", "points": [{"name": "cpu", "tags": {"host": "server01"},"fields": {"value": 100}}]}`) - if status != http.StatusOK { + if status != http.StatusNoContent { t.Fatalf("unexpected status: %d", status) } @@ -1669,7 +1669,7 @@ func TestHandler_ChunkedResponses(t *testing.T) { status, errString := MustHTTP("POST", s.URL+`/write`, nil, nil, `{"database" : "foo", "retentionPolicy" : "bar", "points": [ {"name": "cpu", "tags": {"host": "server01"},"time": "2009-11-10T23:00:00Z", "fields": {"value": 100}}, {"name": "cpu", "tags": {"host": "server02"},"time": "2009-11-10T23:30:00Z", "fields": {"value": 25}}]}`) - if status != http.StatusOK { + if status != http.StatusNoContent { t.Fatalf("unexpected status: %d - %s", status, errString) } time.Sleep(100 * time.Millisecond) // Ensure data node picks up write.