mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #5026 from lodevil/master
KeepAliveOnce error fix (when the lease not found)
This commit is contained in:
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…
x
Reference in New Issue
Block a user