@@ -1006,9 +1006,10 @@ func testServerGracefulStopIdempotent(t *testing.T, e env) {
1006
1006
}
1007
1007
}
1008
1008
1009
- func (s ) TestDetailedConnectionCloseErrorPropagatesToRpcError (t * testing.T ) {
1009
+ func (s ) TestDetailedConnectionCloseErrorPropagatesToRPCError (t * testing.T ) {
1010
1010
rpcStartedOnServer := make (chan struct {})
1011
1011
rpcDoneOnClient := make (chan struct {})
1012
+ defer close (rpcDoneOnClient )
1012
1013
ss := & stubserver.StubServer {
1013
1014
FullDuplexCallF : func (stream testgrpc.TestService_FullDuplexCallServer ) error {
1014
1015
close (rpcStartedOnServer )
@@ -1024,25 +1025,27 @@ func (s) TestDetailedConnectionCloseErrorPropagatesToRpcError(t *testing.T) {
1024
1025
ctx , cancel := context .WithTimeout (context .Background (), defaultTestTimeout )
1025
1026
defer cancel ()
1026
1027
1027
- // Start an RPC. Then, while the RPC is still being accepted or handled at the server, abruptly
1028
- // stop the server, killing the connection. The RPC error message should include details about the specific
1029
- // connection error that was encountered.
1028
+ // Start an RPC. Then, while the RPC is still being accepted or handled at
1029
+ // the server, abruptly stop the server, killing the connection. The RPC
1030
+ // error message should include details about the specific connection error
1031
+ // that was encountered.
1030
1032
stream , err := ss .Client .FullDuplexCall (ctx )
1031
1033
if err != nil {
1032
1034
t .Fatalf ("%v.FullDuplexCall = _, %v, want _, <nil>" , ss .Client , err )
1033
1035
}
1034
- // Block until the RPC has been started on the server. This ensures that the ClientConn will find a healthy
1035
- // connection for the RPC to go out on initially, and that the TCP connection will shut down strictly after
1036
- // the RPC has been started on it.
1036
+ // Block until the RPC has been started on the server. This ensures that the
1037
+ // ClientConn will find a healthy connection for the RPC to go out on
1038
+ // initially, and that the TCP connection will shut down strictly after the
1039
+ // RPC has been started on it.
1037
1040
<- rpcStartedOnServer
1038
1041
ss .S .Stop ()
1039
- // The precise behavior of this test is subject to raceyness around the timing
1040
- // of when TCP packets are sent from client to server, and when we tell the
1041
- // server to stop, so we need to account for both possible error messages.
1042
+ // The precise behavior of this test is subject to raceyness around the
1043
+ // timing of when TCP packets are sent from client to server, and when we
1044
+ // tell the server to stop, so we need to account for both possible error
1045
+ // messages.
1042
1046
if _ , err := stream .Recv (); err == io .EOF || ! isConnClosedErr (err ) {
1043
1047
t .Fatalf ("%v.Recv() = _, %v, want _, rpc error containing substring: %q OR %q" , stream , err , possibleConnResetMsg , possibleEOFMsg )
1044
1048
}
1045
- close (rpcDoneOnClient )
1046
1049
}
1047
1050
1048
1051
func (s ) TestFailFast (t * testing.T ) {
0 commit comments