Gargi-jais11 commented on code in PR #8056:
URL: https://github.com/apache/ozone/pull/8056#discussion_r1995220743


##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/diskbalancer/TestDiskBalancerService.java:
##########
@@ -170,6 +180,86 @@ private DiskBalancerServiceTestImpl getDiskBalancerService(
         threadCount);
   }
 
+  static List<Integer> createVolumeSet() {
+    List<Integer> params = new ArrayList<>();
+    for (int i = 0; i < 4; i++) {
+      params.add(i);
+    }
+    return params;
+  }
+
+  @ParameterizedTest
+  @MethodSource("createVolumeSet")
+  public void testCalculateBytesToMove(Integer i) throws IOException {
+    try {
+      conf.set(ScmConfigKeys.HDDS_DATANODE_DIR_KEY,
+          generateVolumeLocation(testRoot.getAbsolutePath(), i));
+      volumeSet = new MutableVolumeSet(datanodeUuid, scmId, conf, null,
+          StorageVolume.VolumeType.DATA_VOLUME, null);
+      createDbInstancesForTestIfNeeded(volumeSet, scmId, scmId, conf);
+
+      double num1 = 0.02;
+      List<StorageVolume> volumes = new ArrayList<>();
+
+      for (StorageVolume volume : volumeSet.getVolumesList()) {
+        volume.incrementUsedSpace((long) 
(volume.getCurrentUsage().getCapacity() * num1));
+        volumes.add(volume);
+        num1 = 0.8;
+      }
+
+      ContainerSet containerSet = new ContainerSet(1000);
+      ContainerMetrics metrics = ContainerMetrics.create(conf);
+      KeyValueHandler keyValueHandler =
+          new KeyValueHandler(conf, datanodeUuid, containerSet, volumeSet,
+              metrics, c -> {
+          });
+      DiskBalancerServiceTestImpl svc =
+          getDiskBalancerService(containerSet, conf, keyValueHandler, null, 1);
+      svc.setShouldRun(true);
+      svc.setThreshold(10);
+      svc.setQueueSize(2);

Review Comment:
   Because if I don't hard code the queue size than when it checks the actual 
value of bytesToMove through calculateBytesToMove then everytime the queue size 
is 0 as for checking the queue size getTask is not called and when I was trying 
to call it then containerChoosingPolicy was throwing lots of errors to just 
check whether the calculateBytesToMove I did it hardcode



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