HADOOP-19215. Fix unit tests testSlowConnection and testBadSetup failed in TestRPC. (#6912). Contributed by farmmamba.

Reviewed-by: huhaiyang <huhaiyang926@126.com>
Signed-off-by: Ayush Saxena <ayushsaxena@apache.org>
This commit is contained in:
hfutatzhanghb 2024-07-05 14:41:39 +08:00 committed by GitHub
parent c33d868606
commit a57105462b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1038,7 +1038,7 @@ public int read() throws IOException {
// disable ping & timeout to minimize traffic // disable ping & timeout to minimize traffic
clientConf.setBoolean(CommonConfigurationKeys.IPC_CLIENT_PING_KEY, false); clientConf.setBoolean(CommonConfigurationKeys.IPC_CLIENT_PING_KEY, false);
clientConf.setInt(CommonConfigurationKeys.IPC_CLIENT_RPC_TIMEOUT_KEY, 0); clientConf.setInt(CommonConfigurationKeys.IPC_CLIENT_RPC_TIMEOUT_KEY, 0);
RPC.setProtocolEngine(clientConf, TestRpcService.class, ProtobufRpcEngine.class); RPC.setProtocolEngine(clientConf, TestRpcService.class, ProtobufRpcEngine2.class);
// set async mode so that we don't need to implement the input stream // set async mode so that we don't need to implement the input stream
final boolean wasAsync = Client.isAsynchronousMode(); final boolean wasAsync = Client.isAsynchronousMode();
TestRpcService client = null; TestRpcService client = null;
@ -1165,7 +1165,7 @@ public void testBadSetup() throws Exception {
clientConf.set(CommonConfigurationKeys.IPC_MAXIMUM_RESPONSE_LENGTH, clientConf.set(CommonConfigurationKeys.IPC_MAXIMUM_RESPONSE_LENGTH,
"xxx"); "xxx");
RPC.setProtocolEngine(clientConf, TestRpcService.class, RPC.setProtocolEngine(clientConf, TestRpcService.class,
ProtobufRpcEngine.class); ProtobufRpcEngine2.class);
TestRpcService client = null; TestRpcService client = null;
int threadCount = Thread.getAllStackTraces().size(); int threadCount = Thread.getAllStackTraces().size();
try { try {