MCPcopy
hub / github.com/elastic/go-elasticsearch / TestHealth

Function TestHealth

_examples/cloudfunction/function_test.go:45–60  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

43}
44
45func 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}

Callers

nothing calls this directly

Calls 3

PrintfMethod · 0.80
HealthMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected