(t *testing.T)
| 1143 | } |
| 1144 | |
| 1145 | func (s) TestCZClientAndServerSocketMetricsFlowControl(t *testing.T) { |
| 1146 | e := tcpClearRREnv |
| 1147 | te := newTest(t, e) |
| 1148 | // disable BDP |
| 1149 | te.serverInitialWindowSize = 65536 |
| 1150 | te.serverInitialConnWindowSize = 65536 |
| 1151 | te.clientInitialWindowSize = 65536 |
| 1152 | te.clientInitialConnWindowSize = 65536 |
| 1153 | te.startServer(&testServer{security: e.security}) |
| 1154 | defer te.tearDown() |
| 1155 | cc := te.clientConn() |
| 1156 | tc := testgrpc.NewTestServiceClient(cc) |
| 1157 | |
| 1158 | for i := 0; i < 10; i++ { |
| 1159 | doSuccessfulUnaryCall(tc, t) |
| 1160 | } |
| 1161 | |
| 1162 | var cliSktID, svrSktID int64 |
| 1163 | if err := verifyResultWithDelay(func() (bool, error) { |
| 1164 | tchan, _ := channelz.GetTopChannels(0, 0) |
| 1165 | if len(tchan) != 1 { |
| 1166 | return false, fmt.Errorf("there should only be one top channel, not %d", len(tchan)) |
| 1167 | } |
| 1168 | subChans := tchan[0].SubChans() |
| 1169 | if len(subChans) != 1 { |
| 1170 | return false, fmt.Errorf("there should only be one subchannel under top channel %d, not %d", tchan[0].ID, len(subChans)) |
| 1171 | } |
| 1172 | var id int64 |
| 1173 | for id = range subChans { |
| 1174 | break |
| 1175 | } |
| 1176 | sc := channelz.GetSubChannel(id) |
| 1177 | if sc == nil { |
| 1178 | return false, fmt.Errorf("there should only be one socket under subchannel %d, not 0", id) |
| 1179 | } |
| 1180 | skts := sc.Sockets() |
| 1181 | if len(skts) != 1 { |
| 1182 | return false, fmt.Errorf("there should only be one socket under subchannel %d, not %d", sc.ID, len(skts)) |
| 1183 | } |
| 1184 | for id = range skts { |
| 1185 | break |
| 1186 | } |
| 1187 | skt := channelz.GetSocket(id) |
| 1188 | sktData := skt.EphemeralMetrics() |
| 1189 | // 65536 - 5 (Length-Prefixed-Message size) * 10 = 65486 |
| 1190 | if sktData.LocalFlowControlWindow != 65486 || sktData.RemoteFlowControlWindow != 65486 { |
| 1191 | return false, fmt.Errorf("client: (LocalFlowControlWindow, RemoteFlowControlWindow) size should be (65536, 65486), not (%d, %d)", sktData.LocalFlowControlWindow, sktData.RemoteFlowControlWindow) |
| 1192 | } |
| 1193 | ss, _ := channelz.GetServers(0, 0) |
| 1194 | if len(ss) != 1 { |
| 1195 | return false, fmt.Errorf("there should only be one server, not %d", len(ss)) |
| 1196 | } |
| 1197 | ns, _ := channelz.GetServerSockets(ss[0].ID, 0, 0) |
| 1198 | sktData = ns[0].EphemeralMetrics() |
| 1199 | if sktData.LocalFlowControlWindow != 65486 || sktData.RemoteFlowControlWindow != 65486 { |
| 1200 | return false, fmt.Errorf("server: (LocalFlowControlWindow, RemoteFlowControlWindow) size should be (65536, 65486), not (%d, %d)", sktData.LocalFlowControlWindow, sktData.RemoteFlowControlWindow) |
| 1201 | } |
| 1202 | cliSktID, svrSktID = id, ss[0].ID |
nothing calls this directly
no test coverage detected