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

Function TestNewBase_Close

options_test.go:494–511  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

492}
493
494func TestNewBase_Close(t *testing.T) {
495 t.Parallel()
496 c, err := NewBase(
497 WithTransportOptions(
498 elastictransport.WithTransport(&mockTransp{}),
499 ),
500 )
501 if err != nil {
502 t.Fatalf("Unexpected error: %s", err)
503 }
504 if closeErr := c.Close(context.Background()); closeErr != nil {
505 t.Errorf("Unexpected error: %s", closeErr)
506 }
507 _, err = c.Perform(&http.Request{URL: &url.URL{}, Header: make(http.Header)})
508 if err == nil {
509 t.Fatal("Expected error after close")
510 }
511}
512
513func TestNewTyped_Close(t *testing.T) {
514 t.Parallel()

Callers

nothing calls this directly

Calls 4

WithTransportOptionsFunction · 0.85
NewBaseFunction · 0.70
CloseMethod · 0.65
PerformMethod · 0.65

Tested by

no test coverage detected