sadanand48 commented on code in PR #7285:
URL: https://github.com/apache/ozone/pull/7285#discussion_r1793469725
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/OzoneRpcClientTests.java:
##########
@@ -3140,6 +3149,34 @@ void testMultipartUploadOverride(ReplicationConfig
replication)
doMultipartUpload(bucket, keyName, (byte)97, replication);
}
+
+ @Test
+ public void testClientLeakDetector() throws Exception {
+ HddsUtils.setIgnoreReportingLeak(true);
+ OzoneClient client = OzoneClientFactory.getRpcClient(cluster.getConf());
+ String volumeName = UUID.randomUUID().toString();
+ String bucketName = UUID.randomUUID().toString();
+ String keyName = UUID.randomUUID().toString();
+ GenericTestUtils.LogCapturer ozoneClientFactoryLogCapturer =
+ GenericTestUtils.LogCapturer.captureLogs(
+ OzoneClientFactory.getLogger());
+
+ client.getObjectStore().createVolume(volumeName);
+ OzoneVolume volume = client.getObjectStore().getVolume(volumeName);
+ volume.createBucket(bucketName);
+ OzoneBucket bucket = volume.getBucket(bucketName);
+ byte[] data = new byte[10];
+ Arrays.fill(data, (byte) 1);
+ try (OzoneOutputStream out = bucket.createKey(keyName, 10,
+ ReplicationConfig.fromTypeAndFactor(RATIS, ONE), new HashMap<>())) {
+ out.write(data);
+ }
+ client = null;
+ System.gc();
+ GenericTestUtils.waitFor(() -> ozoneClientFactoryLogCapturer.getOutput()
+ .contains("is not closed correctly"), 100, 2000);
+ HddsUtils.setIgnoreReportingLeak(false);
Review Comment:
Disabled it, as I agree too that making change in production code for
testing might not be a good idea. We already have TestLeakDetector to test the
generic functionality.
--
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]