From e252c0c0caca98562507f7def55038a4056aa508 Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Tue, 9 Feb 2016 10:00:05 -0800 Subject: [PATCH] etcd-tester: fix wrong error checking Hash method returns either (nil, err) or (Hash, nil). The current error checking is wrong. It only needs to check the error is either nil or non-nil. This causes panic in https://github.com/coreos/etcd/issues/4463 by allowing the case when resp is nil, but err is not nil. --- tools/functional-tester/etcd-tester/tester.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/functional-tester/etcd-tester/tester.go b/tools/functional-tester/etcd-tester/tester.go index 13d6269be..ffa50218c 100644 --- a/tools/functional-tester/etcd-tester/tester.go +++ b/tools/functional-tester/etcd-tester/tester.go @@ -235,7 +235,7 @@ func (c *cluster) getKVHash() (map[string]int64, error) { kvc := pb.NewKVClient(conn) ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) resp, err := kvc.Hash(ctx, &pb.HashRequest{}) - if resp != nil && err != nil { + if err != nil { return nil, err } cancel()