(t *testing.T)
| 57 | } |
| 58 | |
| 59 | func TestNew_WithMultipleAddresses(t *testing.T) { |
| 60 | t.Parallel() |
| 61 | c, err := New(WithAddresses("http://es01:9200", "http://es02:9200")) |
| 62 | if err != nil { |
| 63 | t.Fatalf("Unexpected error: %s", err) |
| 64 | } |
| 65 | urls := c.Transport.(*elastictransport.Client).URLs() |
| 66 | if len(urls) != 2 { |
| 67 | t.Fatalf("Expected 2 URLs, got %d", len(urls)) |
| 68 | } |
| 69 | if urls[0].String() != "http://es01:9200" { |
| 70 | t.Errorf("Unexpected URL[0], want=http://es01:9200, got=%s", urls[0]) |
| 71 | } |
| 72 | if urls[1].String() != "http://es02:9200" { |
| 73 | t.Errorf("Unexpected URL[1], want=http://es02:9200, got=%s", urls[1]) |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | func TestNew_WithAddressesFromEnvironment(t *testing.T) { |
| 78 | t.Setenv("ELASTICSEARCH_URL", "http://example.com") |
nothing calls this directly
no test coverage detected