test: remove useless local variable
This commit is contained in:
@ -413,8 +413,7 @@ func newTest(t *testing.T, e env) *test {
|
|||||||
// call to te.tearDown to clean up.
|
// call to te.tearDown to clean up.
|
||||||
func (te *test) startServer(ts testpb.TestServiceServer) {
|
func (te *test) startServer(ts testpb.TestServiceServer) {
|
||||||
te.testServer = ts
|
te.testServer = ts
|
||||||
e := te.e
|
te.t.Logf("Running test in %s environment...", te.e.name)
|
||||||
te.t.Logf("Running test in %s environment...", e.name)
|
|
||||||
sopts := []grpc.ServerOption{grpc.MaxConcurrentStreams(te.maxStream)}
|
sopts := []grpc.ServerOption{grpc.MaxConcurrentStreams(te.maxStream)}
|
||||||
if te.maxMsgSize > 0 {
|
if te.maxMsgSize > 0 {
|
||||||
sopts = append(sopts, grpc.MaxMsgSize(te.maxMsgSize))
|
sopts = append(sopts, grpc.MaxMsgSize(te.maxMsgSize))
|
||||||
@ -432,12 +431,12 @@ func (te *test) startServer(ts testpb.TestServiceServer) {
|
|||||||
sopts = append(sopts, grpc.StreamInterceptor(te.streamInt))
|
sopts = append(sopts, grpc.StreamInterceptor(te.streamInt))
|
||||||
}
|
}
|
||||||
la := "localhost:0"
|
la := "localhost:0"
|
||||||
switch e.network {
|
switch te.e.network {
|
||||||
case "unix":
|
case "unix":
|
||||||
la = "/tmp/testsock" + fmt.Sprintf("%d", time.Now())
|
la = "/tmp/testsock" + fmt.Sprintf("%d", time.Now())
|
||||||
syscall.Unlink(la)
|
syscall.Unlink(la)
|
||||||
}
|
}
|
||||||
lis, err := net.Listen(e.network, la)
|
lis, err := net.Listen(te.e.network, la)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
te.t.Fatalf("Failed to listen: %v", err)
|
te.t.Fatalf("Failed to listen: %v", err)
|
||||||
}
|
}
|
||||||
@ -455,7 +454,7 @@ func (te *test) startServer(ts testpb.TestServiceServer) {
|
|||||||
}
|
}
|
||||||
s := grpc.NewServer(sopts...)
|
s := grpc.NewServer(sopts...)
|
||||||
te.srv = s
|
te.srv = s
|
||||||
if e.httpHandler {
|
if te.e.httpHandler {
|
||||||
internal.TestingUseHandlerImpl(s)
|
internal.TestingUseHandlerImpl(s)
|
||||||
}
|
}
|
||||||
if te.healthServer != nil {
|
if te.healthServer != nil {
|
||||||
@ -465,7 +464,7 @@ func (te *test) startServer(ts testpb.TestServiceServer) {
|
|||||||
testpb.RegisterTestServiceServer(s, te.testServer)
|
testpb.RegisterTestServiceServer(s, te.testServer)
|
||||||
}
|
}
|
||||||
addr := la
|
addr := la
|
||||||
switch e.network {
|
switch te.e.network {
|
||||||
case "unix":
|
case "unix":
|
||||||
default:
|
default:
|
||||||
_, port, err := net.SplitHostPort(lis.Addr().String())
|
_, port, err := net.SplitHostPort(lis.Addr().String())
|
||||||
|
Reference in New Issue
Block a user