Copilot commented on code in PR #10255:
URL: https://github.com/apache/ozone/pull/10255#discussion_r3302226895


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/TestContainerStateManager.java:
##########
@@ -302,28 +302,32 @@ public void 
testDeletedContainerWithLowerBcsidStaleReplicaRatis()
   }
 
   /**
-   * DELETED EC container in SCM.
+   * DELETED/DELETING EC container in SCM.
    * Expected: Should send force delete to DN
    */
-  @Test
-  public void 
testDeletedECContainerWithStaleClosedReplicaShouldNotForceDelete()
+  @ParameterizedTest
+  @EnumSource(value = HddsProtos.LifeCycleState.class,
+      names = {"DELETING", "DELETED"})
+  public void 
testECContainerWithStaleClosedReplicaShouldForceDelete(HddsProtos.LifeCycleState
 state)
       throws IOException {
     final DatanodeDetails datanode = randomDatanodeDetails();
     nodeManager.register(datanode, null, null);
-    // Create a DELETED EC container
+    // Create an EC container
     ECReplicationConfig repConfig = new ECReplicationConfig(3, 2);
     final ContainerInfo ecContainer = getECContainer(
-        HddsProtos.LifeCycleState.DELETED,
+        state,
         PipelineID.randomId(),
         repConfig);
     containerStateManager.addContainer(ecContainer.getProtobuf());
     assertEquals(HddsProtos.ReplicationType.EC, 
ecContainer.getReplicationType());
 
     // Verify delete command sent
-    sendReportAndCaptureDeleteCommand(ecContainer, datanode,
+    DeleteContainerCommand deleteCmd = 
sendReportAndCaptureDeleteCommand(ecContainer, datanode,
         ecContainer.getSequenceId(), false, 1, true);
-    // Container should remain as DELETED
-    verifyContainerState(ecContainer.containerID(), 
HddsProtos.LifeCycleState.DELETED);
+    verifyForceDeleteCommand(deleteCmd, ecContainer.containerID(), true, 
+        "Delete command should have force=true for stale EC non-empty 
replica");
+    // Container should be deleted
+    verifyContainerState(ecContainer.containerID(), state);

Review Comment:
   There is a trailing whitespace after the comma in the 
verifyForceDeleteCommand call, and the following comment is misleading (the 
container may be DELETING, not necessarily deleted). Removing the extra space 
and updating the comment avoids checkstyle/editor issues and makes the test 
intent accurate.



-- 
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]

Reply via email to