Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #52 from yuce/streamline-import-bits-test
Browse files Browse the repository at this point in the history
TRIVIAL added a test for the client cache
  • Loading branch information
yuce authored Aug 24, 2017
2 parents 6f04d10 + 52c0fca commit 8b570ce
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions client_it_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,24 @@ func TestStatusToNodeSlicesForIndex(t *testing.T) {
}
}

func TestClientCache(t *testing.T) {
// even though this function isn't really an integration test,
// it needs to access getDirectClient which is not
// available to client_test.go
client := DefaultClient()
client2, err := client.getDirectClient("foo.bar:10101")
if err != nil {
t.Fatal(err)
}
client3, err := client.getDirectClient("foo.bar:10101")
if err != nil {
t.Fatal(err)
}
if client2 != client3 {
t.Fatal("Should return the same client for the same host")
}
}

func getClient() *Client {
uri, err := NewURIFromAddress(":10101")
if err != nil {
Expand Down

0 comments on commit 8b570ce

Please sign in to comment.