Merge pull request #5026 from lodevil/master
KeepAliveOnce error fix (when the lease not found)release-3.0
commit
0d9039f192
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue