adoroszlai commented on code in PR #6806:
URL: https://github.com/apache/ozone/pull/6806#discussion_r1636221541
##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/ozone/container/common/TestEndPoint.java:
##########
@@ -473,10 +473,10 @@ public void testRegisterNoContainerID() throws Exception {
@Test
public void testRegisterRpcTimeout() throws Exception {
final long rpcTimeout = 1000;
- final long tolerance = 200;
- scmServerImpl.setRpcResponseDelay(1500);
+ final long tolerance = 900;
+ scmServerImpl.setRpcResponseDelay(2500);
long start = Time.monotonicNow();
- registerTaskHelper(serverAddress, 1000, false).close();
+ registerTaskHelper(serverAddress, (int) rpcTimeout, false).close();
long end = Time.monotonicNow();
Review Comment:
I think the test should check elapsed time only for `endpointTask.call()`:
```java
final int rpcTimeout = 1000;
final int tolerance = 200;
scmServerImpl.setRpcResponseDelay(rpcTimeout + tolerance * 2);
OzoneConfiguration conf = SCMTestUtils.getConf(tempDir);
try (EndpointStateMachine rpcEndPoint = createEndpoint(conf,
serverAddress, rpcTimeout)) {
rpcEndPoint.setState(EndpointStateMachine.EndPointStates.REGISTER);
RegisterEndpointTask endpointTask = getRegisterEndpointTask(false,
rpcEndPoint, conf);
long start = Time.monotonicNow();
endpointTask.call();
long end = Time.monotonicNow();
assertThat(end - start)
.isGreaterThanOrEqualTo(rpcTimeout)
.isLessThanOrEqualTo(rpcTimeout + tolerance);
} finally {
scmServerImpl.setRpcResponseDelay(0);
}
```
We'd need some refactoring (extract methods) for that.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]