devmadhuu commented on code in PR #12062:
URL: https://github.com/apache/ozone/pull/12062#discussion_r4642997088


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/balancer/TestContainerBalancerTask.java:
##########
@@ -762,9 +775,400 @@ private ContainerReplica createReplica(ContainerID 
containerID,
         .setOriginNodeId(datanodeDetails.getID())
         .setSequenceId(1000L)
         .setBytesUsed(usedBytes)
+        .setStorageType(StorageType.DISK)
+        .setVolumeStorageType(StorageType.DISK)
         .build();
   }
 
+  @ParameterizedTest
+  @ValueSource(booleans = {false, true})
+  public void testRejectedCandidatesAreNotRecheckedForStorageType(boolean 
differentStorageType) throws Exception {
+    DatanodeUsageInfo source = storageTypeNode(80, 80);
+    DatanodeUsageInfo target = storageTypeNode(20, 80);
+    StorageType rejectedType = differentStorageType ? StorageType.DISK : 
StorageType.SSD;
+    List<ContainerID> rejected = new ArrayList<>();
+    for (int i = 0; i < 200; i++) {
+      long id = 1000L + i;
+      addStorageTypeContainer(source, id, rejectedType, 2 * OzoneConsts.MB);
+      ContainerID containerID = ContainerID.valueOf(id);
+      if (!differentStorageType) {
+        cidToInfoMap.get(containerID).setState(HddsProtos.LifeCycleState.OPEN);
+      }
+      rejected.add(containerID);
+    }
+    for (int i = 0; i < 100; i++) {
+      addStorageTypeContainer(source, 2000L + i, StorageType.SSD, 
OzoneConsts.MB);
+    }
+    List<StorageType> order = new ArrayList<>();
+    configureStorageTypeCluster(Arrays.asList(source, target), 0, order);
+    balancerConfiguration.setMaxSizeToMovePerIteration(100 * OzoneConsts.MB);
+    startBalancer(balancerConfiguration);
+
+    assertThat(order).hasSize(100).containsOnly(StorageType.SSD);
+    for (ContainerID containerID : rejected) {
+      verify(scm.getContainerManager(), 
times(1)).getContainerReplicas(containerID);
+    }
+  }
+
+  @ParameterizedTest
+  @ValueSource(booleans = {false, true})
+  public void 
testRejectedContainerRemainsAvailableForAnotherStorageType(boolean 
exceedsSsdLimit) throws Exception {

Review Comment:
   Updated the javadoc.



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