Gargi-jais11 commented on code in PR #8056:
URL: https://github.com/apache/ozone/pull/8056#discussion_r1997531038
##########
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:
I tried passing the volumeSet and OzoneConfiguration to
calculateBytesToMove() without hard coding the queue size to 2 or as volume
count but the bytesToMove is still returning to be 0 due to queuesize = 0 else
after refactoring the unit test as you suggested on hard coding the queue size
to 2 all test case are passing
--
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]