adoroszlai commented on a change in pull request #3135:
URL: https://github.com/apache/ozone/pull/3135#discussion_r814058080
##########
File path:
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/replication/TestMeasuredReplicator.java
##########
@@ -119,4 +119,16 @@ public void testSuccessTimeFailureExcluded() {
Assert.assertEquals(0, measuredReplicator.getSuccessTime().value());
}
+ @Test
+ public void testReplicationQueueTimeMetrics() {
+ ReplicationTask task = new ReplicationTask(100L, new ArrayList<>());
+ try {
+ Thread.sleep(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
Review comment:
Instead of adding sleep, we can override `getQueued()` in `task` to
return a past value. This saves time and reduces randomness.
(Note: needs extra import)
```suggestion
final Instant queued = Instant.now().minus(2, ChronoUnit.MINUTES);
ReplicationTask task = new ReplicationTask(100L, new ArrayList<>()) {
@Override
public Instant getQueued() {
return queued;
}
};
```
--
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]