update tests to expect StatusNoContent

pull/2298/head
ben hockey 2015-04-15 15:50:39 -05:00
parent a4be178280
commit 12322e4df0
2 changed files with 22 additions and 22 deletions

View File

@ -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))
}
}

View File

@ -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.