Merge pull request #941 from MakMukhi/mmukhi_update_server_relection
update pre-generated code and server reflection code to comply with the change to the grpc g…
diff --git a/README.md b/README.md
index 660658b..110a8cf 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@
Prerequisites
-------------
-This requires Go 1.5 or later .
+This requires Go 1.5 or later.
Constraints
-----------
diff --git a/call.go b/call.go
index 788b3d9..772c817 100644
--- a/call.go
+++ b/call.go
@@ -49,9 +49,8 @@
// On error, it returns the error and indicates whether the call should be retried.
//
// TODO(zhaoq): Check whether the received message sequence is valid.
-func recvResponse(dopts dialOptions, t transport.ClientTransport, c *callInfo, stream *transport.Stream, reply interface{}) error {
+func recvResponse(dopts dialOptions, t transport.ClientTransport, c *callInfo, stream *transport.Stream, reply interface{}) (err error) {
// Try to acquire header metadata from the server if there is any.
- var err error
defer func() {
if err != nil {
if _, ok := err.(transport.ConnectionError); !ok {
@@ -61,7 +60,7 @@
}()
c.headerMD, err = stream.Header()
if err != nil {
- return err
+ return
}
p := &parser{r: stream}
for {
@@ -69,7 +68,7 @@
if err == io.EOF {
break
}
- return err
+ return
}
}
c.trailerMD = stream.Trailer()
diff --git a/credentials/oauth/oauth.go b/credentials/oauth/oauth.go
index 8e68c4d..25393cc 100644
--- a/credentials/oauth/oauth.go
+++ b/credentials/oauth/oauth.go
@@ -61,7 +61,7 @@
}, nil
}
-// RequireTransportSecurity indicates whether the credentails requires transport security.
+// RequireTransportSecurity indicates whether the credentials requires transport security.
func (ts TokenSource) RequireTransportSecurity() bool {
return true
}
diff --git a/examples/README.md b/examples/README.md
index b65f8c5..6ea6b35 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -8,7 +8,7 @@
PREREQUISITES
-------------
-- This requires Go 1.4
+- This requires Go 1.5 or later
- Requires that [GOPATH is set](https://golang.org/doc/code.html#GOPATH)
```
diff --git a/reflection/serverreflection_test.go b/reflection/serverreflection_test.go
index ca9610e..1759e66 100644
--- a/reflection/serverreflection_test.go
+++ b/reflection/serverreflection_test.go
@@ -192,6 +192,9 @@
c := rpb.NewServerReflectionClient(conn)
stream, err := c.ServerReflectionInfo(context.Background())
+ if err != nil {
+ t.Fatalf("cannot get ServerReflectionInfo: %v", err)
+ }
testFileByFilename(t, stream)
testFileByFilenameError(t, stream)
diff --git a/stress/client/main.go b/stress/client/main.go
index 4579aab..89df93d 100644
--- a/stress/client/main.go
+++ b/stress/client/main.go
@@ -180,7 +180,7 @@
return nil, grpc.Errorf(codes.InvalidArgument, "gauge with name %s not found", in.Name)
}
-// createGauge creates a guage using the given name in metrics server.
+// createGauge creates a gauge using the given name in metrics server.
func (s *server) createGauge(name string) *gauge {
s.mutex.Lock()
defer s.mutex.Unlock()
diff --git a/test/end2end_test.go b/test/end2end_test.go
index d12a1f9..5e942dc 100644
--- a/test/end2end_test.go
+++ b/test/end2end_test.go
@@ -2504,8 +2504,7 @@
cc := te.clientConn()
tc := testpb.NewTestServiceClient(cc)
- ctx, cancel := context.WithCancel(context.Background())
- if _, err := tc.StreamingInputCall(ctx); err != nil {
+ if _, err := tc.StreamingInputCall(context.Background()); err != nil {
t.Fatalf("%v.StreamingInputCall(_) = _, %v, want _, <nil>", tc, err)
}
// Loop until the new max stream setting is effective.
@@ -2522,18 +2521,26 @@
}
t.Fatalf("%v.StreamingInputCall(_) = _, %v, want _, %s", tc, err, codes.DeadlineExceeded)
}
- cancel()
var wg sync.WaitGroup
- for i := 0; i < 100; i++ {
+ for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
defer wg.Done()
- ctx, cancel := context.WithCancel(context.Background())
- if _, err := tc.StreamingInputCall(ctx); err != nil {
- t.Errorf("%v.StreamingInputCall(_) = _, %v, want _, <nil>", tc, err)
+ payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, 314)
+ if err != nil {
+ t.Fatal(err)
}
- cancel()
+ req := &testpb.SimpleRequest{
+ ResponseType: testpb.PayloadType_COMPRESSABLE.Enum(),
+ ResponseSize: proto.Int32(1592),
+ Payload: payload,
+ }
+ // No rpc should go through due to the max streams limit.
+ ctx, _ := context.WithTimeout(context.Background(), 10*time.Millisecond)
+ if _, err := tc.UnaryCall(ctx, req, grpc.FailFast(false)); grpc.Code(err) != codes.DeadlineExceeded {
+ t.Errorf("TestService/UnaryCall(_, _) = _, %v, want _, %s", err, codes.DeadlineExceeded)
+ }
}()
}
wg.Wait()