(t *testing.T)
| 43 | } |
| 44 | |
| 45 | func TestHealth(t *testing.T) { |
| 46 | clusterstatus.ES, _ = elasticsearch.New( |
| 47 | elasticsearch.WithTransportOptions(elastictransport.WithTransport(&MockTransport{})), |
| 48 | ) |
| 49 | |
| 50 | w := httptest.NewRecorder() |
| 51 | clusterstatus.Health(w, &http.Request{}) |
| 52 | |
| 53 | resp := w.Result() |
| 54 | body, _ := ioutil.ReadAll(resp.Body) |
| 55 | fmt.Printf("> %s %s\n> %s\n", resp.Status, resp.Header.Get("Content-Type"), body) |
| 56 | |
| 57 | if string(body) != `{"status":"mocked"}` { |
| 58 | t.Errorf("Unexpected body: %s", body) |
| 59 | } |
| 60 | } |