smengcl commented on a change in pull request #2988:
URL: https://github.com/apache/ozone/pull/2988#discussion_r787018187
##########
File path:
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneRpcClientAbstract.java
##########
@@ -297,6 +297,26 @@ public void testVolumeSetOwner() throws IOException {
proxy.setVolumeOwner(volumeName, ownerName);
}
+ @Test
+ public void testBucketSetOwner() throws IOException {
+ String volumeName = UUID.randomUUID().toString();
+ String bucketName = UUID.randomUUID().toString();
+ store.createVolume(volumeName);
+ store.getVolume(volumeName).createBucket(bucketName);
+
+ String oldOwner = store.getVolume(volumeName).getBucket(bucketName)
+ .getOwner();
+ String ownerName = "testUser";
+
+ ClientProtocol proxy = store.getClientProxy();
+ proxy.setBucketOwner(volumeName, bucketName, ownerName);
+ String newOwner = store.getVolume(volumeName).getBucket(bucketName)
+ .getOwner();
+
+ assertEquals(ownerName, newOwner);
+ assertNotEquals(oldOwner, newOwner);
+ }
Review comment:
Yes it is unfortunate that not all UTs clean up after themselves.
ofc when the **whole** test class shuts down everything should be wiped. But
in-between test cases in the same test class, it is often not. Test cases in
the same (integration) test class usually share the same cluster to speed up
the test suite.
A lot of the times not cleaning up interferes with some test cases (e.g.
ones that checks for number of volumes or expects a clean cluster), which
doesn't play nicely with newly contributed test cases later. It is generally a
good practice to do the clean up.
Let's not bother with other test cases in this class for now. Appending the
two lines to your new test case would suffice for this PR.
--
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]