Merge pull request #5026 from lodevil/master

KeepAliveOnce error fix (when the lease not found)
release-3.0
Gyu-Ho Lee 2016-04-10 17:35:52 -07:00
commit 0d9039f192
2 changed files with 10 additions and 0 deletions

View File

@ -23,6 +23,8 @@ import (
"github.com/coreos/etcd/integration"
"github.com/coreos/etcd/pkg/testutil"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
)
func TestLeaseGrant(t *testing.T) {
@ -92,6 +94,11 @@ func TestLeaseKeepAliveOnce(t *testing.T) {
if err != nil {
t.Errorf("failed to keepalive lease %v", err)
}
_, err = lapi.KeepAliveOnce(context.Background(), clientv3.LeaseID(0))
if grpc.Code(err) != codes.NotFound {
t.Errorf("invalid error returned %v", err)
}
}
func TestLeaseKeepAlive(t *testing.T) {

View File

@ -181,6 +181,9 @@ func (l *lessor) KeepAliveOnce(ctx context.Context, id LeaseID) (*LeaseKeepAlive
if err == nil {
return resp, err
}
if isHalted(ctx, err) {
return resp, err
}
nerr := l.switchRemoteAndStream(err)
if nerr != nil {