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

Function TestNew_CloudIDOverridesEnvironment

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

Source from the content-addressed store, hash-verified

111}
112
113func TestNew_CloudIDOverridesEnvironment(t *testing.T) {
114 t.Setenv("ELASTICSEARCH_URL", "http://example.com")
115 c, err := New(WithCloudID("foo:YmFyLmNsb3VkLmVzLmlvJGFiYzEyMyRkZWY0NTY="))
116 if err != nil {
117 t.Fatalf("Unexpected error: %s", err)
118 }
119 u := c.Transport.(*elastictransport.Client).URLs()[0].String()
120 if u != "https://abc123.bar.cloud.es.io" {
121 t.Errorf("Unexpected URL, want=https://abc123.bar.cloud.es.io, got=%s", u)
122 }
123}
124
125func TestNew_AddressesAndCloudID_Error(t *testing.T) {
126 t.Parallel()

Callers

nothing calls this directly

Calls 3

WithCloudIDFunction · 0.85
NewFunction · 0.50
StringMethod · 0.45

Tested by

no test coverage detected