Gargi-jais11 commented on code in PR #10284:
URL: https://github.com/apache/ozone/pull/10284#discussion_r3256500564
##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/diskbalancer/TestDiskBalancerService.java:
##########
@@ -379,6 +404,57 @@ public void testConcurrentTasksNotExceedThreadLimit()
throws Exception {
100, 5000);
}
+ @Test
+ public void testDiskBalancerInfoWriteCreatesParentDirectory()
+ throws Exception {
+ File infoDir = tmpDir.resolve("nested").toFile();
+ DiskBalancerServiceTestImpl svc =
+ getDiskBalancerService(confWithDiskBalancerInfoDir(infoDir));
+ DiskBalancerInfo info = new DiskBalancerInfo(
+ DiskBalancerRunningStatus.RUNNING, 10.0d, 100L, 5, true);
+
+ svc.refresh(info);
+
+ assertEquals(info,
+ DiskBalancerYaml.readDiskBalancerInfoFile(
+ getDiskBalancerInfoFile(infoDir)));
+ svc.shutdown();
+ }
+
+ @Test
+ public void testDiskBalancerInfoWriteReportsDirectoryCreationFailure()
+ throws Exception {
+ File infoDir = tmpDir.resolve("diskBalancer-parent").toFile();
+ assertTrue(infoDir.createNewFile());
+
+ IOException exception = assertThrows(IOException.class,
+ () -> getDiskBalancerService(confWithDiskBalancerInfoDir(infoDir)));
+
+ assertThat(exception)
+ .hasMessageStartingWith("Unable to create DiskBalancerInfo
directories: ");
+ }
+
+ @Test
Review Comment:
Use @ContainerTestVersionInfo.ContainerTest to test for each schema and
layout.
##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/diskbalancer/TestDiskBalancerService.java:
##########
@@ -379,6 +404,57 @@ public void testConcurrentTasksNotExceedThreadLimit()
throws Exception {
100, 5000);
}
+ @Test
+ public void testDiskBalancerInfoWriteCreatesParentDirectory()
+ throws Exception {
+ File infoDir = tmpDir.resolve("nested").toFile();
+ DiskBalancerServiceTestImpl svc =
+ getDiskBalancerService(confWithDiskBalancerInfoDir(infoDir));
+ DiskBalancerInfo info = new DiskBalancerInfo(
+ DiskBalancerRunningStatus.RUNNING, 10.0d, 100L, 5, true);
+
+ svc.refresh(info);
+
+ assertEquals(info,
+ DiskBalancerYaml.readDiskBalancerInfoFile(
+ getDiskBalancerInfoFile(infoDir)));
+ svc.shutdown();
+ }
+
+ @Test
Review Comment:
Use @ContainerTestVersionInfo.ContainerTest to test for each schema and
layout.
##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/diskbalancer/TestDiskBalancerService.java:
##########
@@ -379,6 +404,57 @@ public void testConcurrentTasksNotExceedThreadLimit()
throws Exception {
100, 5000);
}
+ @Test
Review Comment:
Use `@ContainerTestVersionInfo.ContainerTest` to test for each schema and
layout.
--
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]