Skip to content

Commit f712505

Browse files
committed
Fix tests
There might as well be clients listening on 9201, 9202 etc. So I chose ports that are more unlikely to have Elasticsearch listen on it.
1 parent 949c9bd commit f712505

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

client_test.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func TestMultipleUrls(t *testing.T) {
3535
}
3636

3737
func TestFindingActiveClient(t *testing.T) {
38-
client, err := NewClient(http.DefaultClient, "http://localhost:9201", "http://localhost:9200")
38+
client, err := NewClient(http.DefaultClient, "http://localhost:19200", "http://localhost:9200")
3939
if err != nil {
4040
t.Fatal(err)
4141
}
@@ -45,13 +45,14 @@ func TestFindingActiveClient(t *testing.T) {
4545
if !client.hasActive {
4646
t.Errorf("expected to have active connection, got: %v", client.hasActive)
4747
}
48-
if client.activeUrl != "http://localhost:9200" {
49-
t.Errorf("expected active url to be http://localhost:9200, got: %v", client.activeUrl)
48+
expected := "http://localhost:9200"
49+
if client.activeUrl != expected {
50+
t.Errorf("expected active url to be %s, got: %v", expected, client.activeUrl)
5051
}
5152
}
5253

5354
func TestFindingNoActiveClient(t *testing.T) {
54-
client, err := NewClient(http.DefaultClient, "http://localhost:9201", "http://localhost:9202")
55+
client, err := NewClient(http.DefaultClient, "http://localhost:19200", "http://localhost:19201")
5556
if err != nil {
5657
t.Fatal(err)
5758
}

0 commit comments

Comments
 (0)