Tejaskriya commented on code in PR #8491: URL: https://github.com/apache/ozone/pull/8491#discussion_r2115749564
########## hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/balancer/TestMoveManager.java: ########## @@ -496,6 +499,44 @@ public void testMoveCompleteFutureReplicasUnhealthy() throws Exception { .sendDeleteCommand(eq(containerInfo), eq(0), eq(src), eq(true)); } + @Test + public void testDeleteNotSentWithExpirationTimeInPast() throws Exception { + containerInfo = ReplicationTestUtil.createContainer( + HddsProtos.LifeCycleState.CLOSED, new ECReplicationConfig(3, 2)); + setupMocks(); + + replicas.addAll(ReplicationTestUtil + .createReplicas(containerInfo.containerID(), 1, 2, 3, 4, 5)); + Iterator<ContainerReplica> iterator = replicas.iterator(); + ContainerReplica srcReplica = iterator.next(); + src = srcReplica.getDatanodeDetails(); + tgt = MockDatanodeDetails.randomDatanodeDetails(); + nodes.put(src, NodeStatus.inServiceHealthy()); + nodes.put(tgt, NodeStatus.inServiceHealthy()); + + CompletableFuture<MoveManager.MoveResult> res = + moveManager.move(containerInfo.containerID(), src, tgt); + ContainerReplicaOp op = new ContainerReplicaOp( + ADD, tgt, srcReplica.getReplicaIndex(), null, clock.millis() + 1000); + moveManager.opCompleted(op, containerInfo.containerID(), false); + + ArgumentCaptor<Long> longCaptor = ArgumentCaptor.forClass(Long.class); + verify(replicationManager).sendDeleteCommand( + eq(containerInfo), eq(srcReplica.getReplicaIndex()), eq(src), + eq(true), longCaptor.capture()); + + // 6 minutes is the datanodeTimeoutOffset set for datanodeCommands sent by replicationManager by default + assertTrue((Duration.ofMillis(longCaptor.getValue()).toMillis() + - Duration.ofMinutes(6).toMillis()) > clock.millis()); Review Comment: Thanks for pointing these out. I have made the necessary changes in my later commits -- 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: issues-unsubscr...@ozone.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org For additional commands, e-mail: issues-h...@ozone.apache.org