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

Function TestNew_WithAddressesOverridesEnvironment

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

Source from the content-addressed store, hash-verified

87}
88
89func TestNew_WithAddressesOverridesEnvironment(t *testing.T) {
90 t.Setenv("ELASTICSEARCH_URL", "http://example.com")
91 c, err := New(WithAddresses("http://localhost:8080"))
92 if err != nil {
93 t.Fatalf("Unexpected error: %s", err)
94 }
95 u := c.Transport.(*elastictransport.Client).URLs()[0].String()
96 if u != "http://localhost:8080" {
97 t.Errorf("Unexpected URL, want=http://localhost:8080, got=%s", u)
98 }
99}
100
101func TestNew_WithCloudID(t *testing.T) {
102 t.Parallel()

Callers

nothing calls this directly

Calls 3

WithAddressesFunction · 0.85
NewFunction · 0.50
StringMethod · 0.45

Tested by

no test coverage detected