clientv3: panic if ActiveConnection tries to return non-nil connection

This commit is contained in:
Anthony Romano
2016-06-03 00:16:52 -07:00
parent 267d1cb16f
commit 7dfe7db243
3 changed files with 5 additions and 10 deletions

View File

@@ -292,6 +292,9 @@ func newClient(cfg *Config) (*Client, error) {
func (c *Client) ActiveConnection() *grpc.ClientConn {
c.mu.RLock()
defer c.mu.RUnlock()
if c.conn == nil {
panic("trying to return nil active connection")
}
return c.conn
}

View File

@@ -20,7 +20,7 @@ import (
)
func TestTxnPanics(t *testing.T) {
kv := NewKV(&Client{})
kv := &kv{}
errc := make(chan string)
df := func() {