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

Function TestClientInterface

elasticsearch_internal_test.go:235–256  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

233}
234
235func TestClientInterface(t *testing.T) {
236 t.Run("Transport", func(t *testing.T) {
237 c, err := New(WithTransportOptions(elastictransport.WithTransport(&mockTransp{})))
238
239 if err != nil {
240 t.Fatalf("Unexpected error: %s", err)
241 }
242
243 if called != false { // megacheck ignore
244 t.Errorf("Unexpected call to transport by client")
245 }
246
247 _, err = c.Perform(&http.Request{URL: &url.URL{}, Header: make(http.Header)})
248 if err != nil {
249 t.Fatalf("Unexpected error: %s", err)
250 }
251
252 if called != true { // megacheck ignore
253 t.Errorf("Expected client to call transport")
254 }
255 })
256}
257
258func TestAddrsToURLs(t *testing.T) {
259 tt := []struct {

Callers

nothing calls this directly

Calls 4

WithTransportOptionsFunction · 0.85
PerformMethod · 0.65
NewFunction · 0.50
RunMethod · 0.45

Tested by

no test coverage detected