(t *testing.T)
| 75 | } |
| 76 | |
| 77 | func 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 | |
| 89 | func TestNew_WithAddressesOverridesEnvironment(t *testing.T) { |
| 90 | t.Setenv("ELASTICSEARCH_URL", "http://example.com") |