clientv3: only block on New() when DialTimeout > 0

Fixes #6162
This commit is contained in:
Anthony Romano
2016-08-12 09:42:18 -07:00
parent 965b2901d5
commit 429d5ab20b
2 changed files with 16 additions and 5 deletions

View File

@ -56,6 +56,15 @@ func TestDialTimeout(t *testing.T) {
}
}
func TestDialNoTimeout(t *testing.T) {
cfg := Config{Endpoints: []string{"127.0.0.1:12345"}}
c, err := New(cfg)
if c == nil || err != nil {
t.Fatalf("new client with DialNoWait should succeed, got %v", err)
}
c.Close()
}
func TestIsHaltErr(t *testing.T) {
if !isHaltErr(nil, fmt.Errorf("etcdserver: some etcdserver error")) {
t.Errorf(`error prefixed with "etcdserver: " should be Halted by default`)