GlenGeng commented on a change in pull request #2077:
URL: https://github.com/apache/ozone/pull/2077#discussion_r600295679
##########
File path:
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainer.java
##########
@@ -206,8 +206,32 @@ public void testContainerImportExport() throws Exception {
fail("Container is imported twice. Previous files are overwritten");
} catch (IOException ex) {
//all good
+ assertTrue(container.getContainerFile().exists());
}
+ //Import failure should cleanup the container directory
+ containerData =
+ new KeyValueContainerData(containerId + 1,
+ keyValueContainerData.getLayOutVersion(),
+ keyValueContainerData.getMaxSize(), UUID.randomUUID().toString(),
+ datanodeId.toString());
+ container = new KeyValueContainer(containerData, CONF);
+
+ containerVolume = volumeChoosingPolicy.chooseVolume(volumeSet
+ .getVolumesList(), 1);
+ hddsVolumeDir = containerVolume.getHddsRootDir().toString();
+ container.populatePathFields(scmId, containerVolume, hddsVolumeDir);
+ try (FileInputStream fis = new FileInputStream(folderToExport)) {
Review comment:
since you close `fis` explicitly, no need try with resource. Just
```
try {
FileInputStream fis = new FileInputStream(folderToExport);
fis.close();
}
```
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]