aajisaka commented on a change in pull request #2767:
URL: https://github.com/apache/hadoop/pull/2767#discussion_r610378108
##########
File path:
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestProtoBufRpc.java
##########
@@ -179,10 +281,41 @@ public void testProtoBufRpc2() throws Exception {
MetricsRecordBuilder rpcDetailedMetrics =
getMetrics(server.getRpcDetailedMetrics().name());
assertCounterGt("Echo2NumOps", 0L, rpcDetailedMetrics);
+
+ if (testWithLegacy) {
+ testProtobufLegacy();
+ }
+ }
+
+ private void testProtobufLegacy()
+ throws IOException, com.google.protobuf.ServiceException {
+ TestRpcService2Legacy client = getClientLegacy();
+
+ // Test ping method
+ client.ping2(null,
TestProtosLegacy.EmptyRequestProto.newBuilder().build());
+
+ // Test echo method
+ TestProtosLegacy.EchoResponseProto echoResponse = client.echo2(null,
+ TestProtosLegacy.EchoRequestProto.newBuilder().setMessage("hello")
+ .build());
+ assertThat(echoResponse.getMessage()).isEqualTo("hello");
+
+ // Ensure RPC metrics are updated
+ MetricsRecordBuilder rpcMetrics =
getMetrics(server.getRpcMetrics().name());
+ assertCounterGt("RpcQueueTimeNumOps", 0L, rpcMetrics);
+ assertCounterGt("RpcProcessingTimeNumOps", 0L, rpcMetrics);
+
+ MetricsRecordBuilder rpcDetailedMetrics =
+ getMetrics(server.getRpcDetailedMetrics().name());
+ assertCounterGt("Echo2NumOps", 0L, rpcDetailedMetrics);
}
@Test (timeout=5000)
public void testProtoBufRandomException() throws Exception {
+ if (testWithLegacy) {
+ //No test with legacy
+ return;
+ }
Review comment:
`assumeFalse(testWithLegacy)` can be used instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]