You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "adoroszlai (via GitHub)" <gi...@apache.org> on 2023/03/15 16:28:52 UTC
[GitHub] [ozone] adoroszlai commented on a diff in pull request #4373: HDDS-7958. Ozone client not closed in integration tests
adoroszlai commented on code in PR #4373:
URL: https://github.com/apache/ozone/pull/4373#discussion_r1137403765
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFSBucketLayout.java:
##########
@@ -116,19 +118,21 @@ public static void initCluster() throws Exception {
.setNumDatanodes(3)
.build();
cluster.waitForClusterToBeReady();
- objectStore = cluster.getClient().getObjectStore();
+ client = cluster.getClient();
+ objectStore = client.getObjectStore();
rootPath = String.format("%s://%s/",
OzoneConsts.OZONE_OFS_URI_SCHEME, conf.get(OZONE_OM_ADDRESS_KEY));
// create a volume and a bucket to be used by RootedOzoneFileSystem (OFS)
volumeName =
- TestDataUtil.createVolumeAndBucket(cluster)
+ TestDataUtil.createVolumeAndBucket(client)
.getVolumeName();
volumePath = new Path(OZONE_URI_DELIMITER, volumeName);
}
@AfterClass
public static void teardown() throws IOException {
+ IOUtils.closeQuietly(client);
Review Comment:
Since `client` is declared as `OzoneClient`, it will be a `null` instance of that type.
Added a test (with `ByteArrayOutputStream` as `hdds-common` doesn't know `OzoneClient`) to verify.
Also added `null` check for array.
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneCluster.java:
##########
@@ -178,15 +178,6 @@ void waitForPipelineTobeReady(HddsProtos.ReplicationFactor factor,
*/
OzoneClient getClient() throws IOException;
Review Comment:
Great idea.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org