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

Function TestNew_WithAddressesFromEnvironment

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

Source from the content-addressed store, hash-verified

75}
76
77func TestNew_WithAddressesFromEnvironment(t *testing.T) {
78 t.Setenv("ELASTICSEARCH_URL", "http://example.com")
79 c, err := New()
80 if err != nil {
81 t.Fatalf("Unexpected error: %s", err)
82 }
83 u := c.Transport.(*elastictransport.Client).URLs()[0].String()
84 if u != "http://example.com" {
85 t.Errorf("Unexpected URL, want=http://example.com, got=%s", u)
86 }
87}
88
89func TestNew_WithAddressesOverridesEnvironment(t *testing.T) {
90 t.Setenv("ELASTICSEARCH_URL", "http://example.com")

Callers

nothing calls this directly

Calls 2

NewFunction · 0.50
StringMethod · 0.45

Tested by

no test coverage detected