Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <rleungx@gmail.com>
  • Loading branch information
rleungx committed Aug 9, 2022
1 parent dc4bfd4 commit 9f9ce3f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

1 change: 1 addition & 0 deletions server/embed/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package embed
import (
"errors"
"fmt"
"math"
"net"
"net/http"
"net/url"
Expand Down
2 changes: 1 addition & 1 deletion server/embed/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,8 @@ func (e *Etcd) serveClients() (err error) {
Time: e.cfg.GRPCKeepAliveInterval,
Timeout: e.cfg.GRPCKeepAliveTimeout,
}))
gopts = append(gopts, e.cfg.GRPCAdditionalServerOptions...)
}
gopts = append(gopts, e.cfg.GRPCAdditionalServerOptions...)

// start client servers in each goroutine
for _, sctx := range e.sctxs {
Expand Down
14 changes: 6 additions & 8 deletions tests/framework/integration/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,11 +556,10 @@ type Member struct {
Server *etcdserver.EtcdServer
ServerClosers []func()

GrpcServerOpts []grpc.ServerOption
GrpcAdditionalServerOpts []grpc.ServerOption
GrpcServer *grpc.Server
GrpcURL string
GrpcBridge *bridge
GrpcServerOpts []grpc.ServerOption
GrpcServer *grpc.Server
GrpcURL string
GrpcBridge *bridge

// ServerClient is a clientv3 that directly calls the etcdserver.
ServerClient *clientv3.Client
Expand Down Expand Up @@ -700,7 +699,7 @@ func MustNewMember(t testutil.TB, mcfg MemberConfig) *Member {
Timeout: mcfg.GrpcKeepAliveTimeout,
}))
}
m.GrpcAdditionalServerOpts = mcfg.GrpcAdditionalServerOptions
m.GrpcServerOpts = append(m.GrpcServerOpts, mcfg.GrpcAdditionalServerOptions...)
m.ClientMaxCallSendMsgSize = mcfg.ClientMaxCallSendMsgSize
m.ClientMaxCallRecvMsgSize = mcfg.ClientMaxCallRecvMsgSize
m.UseIP = mcfg.UseIP
Expand Down Expand Up @@ -944,8 +943,7 @@ func (m *Member) Launch() error {
return err
}
}
opts := append(m.GrpcServerOpts, m.GrpcAdditionalServerOpts...)
m.GrpcServer = v3rpc.Server(m.Server, tlscfg, m.GrpcServerRecorder.UnaryInterceptor(), opts...)
m.GrpcServer = v3rpc.Server(m.Server, tlscfg, m.GrpcServerRecorder.UnaryInterceptor(), m.GrpcServerOpts...)
m.ServerClient = v3client.New(m.Server)
lockpb.RegisterLockServer(m.GrpcServer, v3lock.NewLockServer(m.ServerClient))
epb.RegisterElectionServer(m.GrpcServer, v3election.NewElectionServer(m.ServerClient))
Expand Down
15 changes: 13 additions & 2 deletions tests/integration/v3_grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1912,12 +1912,23 @@ func TestV3LargeRequests(t *testing.T) {
if !eqErrGRPC(err, test.expectError) {
t.Errorf("#%d: expected error %v, got %v", i, test.expectError, err)
}

// request went through, expect large response back from server
if test.expectError == nil {
reqget := &pb.RangeRequest{Key: []byte("foo")}
// limit receive call size with original value + gRPC overhead bytes
_, err = kvcli.Range(context.TODO(), reqget, grpc.MaxCallRecvMsgSize(test.valueSize+512*1024))
if err != nil {
t.Errorf("#%d: range expected no error, got %v", i, err)
}
}

})
}
}

// TestV3AdditionGRPCOptions ensures that configurable GRPCAdditionalServerOptions works as intended.
func TestV3AdditionGRPCOptions(t *testing.T) {
// TestV3AdditionalGRPCOptions ensures that configurable GRPCAdditionalServerOptions works as intended.
func TestV3AdditionalGRPCOptions(t *testing.T) {
integration.BeforeTest(t)
tests := []struct {
maxRequestBytes uint
Expand Down

0 comments on commit 9f9ce3f

Please sign in to comment.