sreejasahithi commented on code in PR #9769:
URL: https://github.com/apache/ozone/pull/9769#discussion_r2812843843
##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestVolumeSet.java:
##########
@@ -155,31 +145,24 @@ public void testVolumeInInconsistentState() throws
Exception {
assertNumVolumes(volumeSet, 2, 0);
assertEquals(2, volumeSet.getVolumesList().size());
- // Add a volume to VolumeSet
- String volume3 = baseDir + "disk3";
+ String volume3 = baseDir.resolve("disk3").toString();
- // Create the root volume dir and create a sub-directory within it.
File newVolume = new File(volume3, HDDS_VOLUME_DIR);
- System.out.println("new volume root: " + newVolume);
assertTrue(newVolume.mkdirs());
- assertTrue(newVolume.exists(), "Failed to create new volume root");
+ assertTrue(newVolume.exists());
File dataDir = new File(newVolume, "chunks");
assertTrue(dataDir.mkdirs());
assertTrue(dataDir.exists());
- // The new volume is in an inconsistent state as the root dir is
- // non-empty but the version file does not exist. Add Volume should
- // return false.
+ // Root dir is non-empty but version file is missing, so the volume should
not be loaded.
conf.set(ScmConfigKeys.HDDS_DATANODE_DIR_KEY,
conf.get(ScmConfigKeys.HDDS_DATANODE_DIR_KEY) + "," + volume3);
volumeSet.shutdown();
initializeVolumeSet();
assertEquals(2, volumeSet.getVolumesList().size());
- assertFalse(checkVolumeExistsInVolumeSet(volume3), "AddVolume should fail"
+
- " for an inconsistent volume");
+ assertFalse(checkVolumeExistsInVolumeSet(volume3));
assertNumVolumes(volumeSet, 2, 1);
- // Delete volume3
File volume = new File(volume3);
FileUtils.deleteDirectory(volume);
Review Comment:
nit: Since this variable is only used when calling deleteDirectory, we can
avoid creating a separate variable
```suggestion
FileUtils.deleteDirectory(new File(volume3));
```
--
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]