|
@@ -19,11 +19,13 @@ import (
|
|
|
"testing"
|
|
"testing"
|
|
|
"time"
|
|
"time"
|
|
|
|
|
|
|
|
|
|
+ "golang.org/x/net/context"
|
|
|
|
|
+ "google.golang.org/grpc/metadata"
|
|
|
|
|
+
|
|
|
"github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes"
|
|
"github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes"
|
|
|
pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
|
|
pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
|
|
|
"github.com/coreos/etcd/mvcc/mvccpb"
|
|
"github.com/coreos/etcd/mvcc/mvccpb"
|
|
|
"github.com/coreos/etcd/pkg/testutil"
|
|
"github.com/coreos/etcd/pkg/testutil"
|
|
|
- "golang.org/x/net/context"
|
|
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
// TestV3LeasePrmote ensures the newly elected leader can promote itself
|
|
// TestV3LeasePrmote ensures the newly elected leader can promote itself
|
|
@@ -356,7 +358,9 @@ func TestV3LeaseFailover(t *testing.T) {
|
|
|
|
|
|
|
|
lreq := &pb.LeaseKeepAliveRequest{ID: lresp.ID}
|
|
lreq := &pb.LeaseKeepAliveRequest{ID: lresp.ID}
|
|
|
|
|
|
|
|
- ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
|
|
|
+ md := metadata.Pairs(rpctypes.MetadataRequireLeaderKey, rpctypes.MetadataHasLeader)
|
|
|
|
|
+ mctx := metadata.NewContext(context.Background(), md)
|
|
|
|
|
+ ctx, cancel := context.WithCancel(mctx)
|
|
|
defer cancel()
|
|
defer cancel()
|
|
|
lac, err := lc.LeaseKeepAlive(ctx)
|
|
lac, err := lc.LeaseKeepAlive(ctx)
|
|
|
if err != nil {
|
|
if err != nil {
|