Copilot commented on code in PR #10859:
URL: https://github.com/apache/ozone/pull/10859#discussion_r3644344176


##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestBucketManagerImpl.java:
##########
@@ -540,4 +554,114 @@ public void testListBucketsResolvesFsoAndObsLinkLayouts() 
throws Exception {
     assertEquals(volume, listedObsLink.getSourceVolume());
     assertEquals("obs-source", listedObsLink.getSourceBucket());
   }
+
+  @Test
+  void testGetBucketInfoDoesNotCopySourcePropertiesWithoutReadAccess() throws 
Exception {
+    String linkVolume = volumeName();
+    String sourceVolume = volumeName();
+    OmBucketInfo link = createLinkBucketInfo(linkVolume, sourceVolume);
+    OmBucketInfo source = createSourceBucketInfo(sourceVolume);
+    BucketManager bucketManager = mock(BucketManager.class);
+    when(bucketManager.getBucketInfo(linkVolume, "link")).thenReturn(link);
+    when(bucketManager.getBucketInfo(sourceVolume, 
"source")).thenReturn(source);
+    OmMetadataReader metadataReader = mock(OmMetadataReader.class);
+    denySourceRead(metadataReader, sourceVolume);
+    OzoneManager omSpy = createAclEnabledOmSpy(bucketManager, metadataReader);
+
+    OmBucketInfo result = omSpy.getBucketInfo(linkVolume, "link");
+
+    assertSame(link, result);
+    verify(metadataReader).checkAcls(BUCKET, OZONE, READ, sourceVolume, 
"source", null);
+  }

Review Comment:
   This test name says source properties should not be copied when source READ 
is denied, but the assertion only checks object identity (assertSame). That’s 
brittle and doesn’t actually assert the behavioral contract (no source 
operational properties leak) or that the source bucket isn’t fetched. Consider 
asserting metadata does not include source entries and verifying the source 
getBucketInfo is not invoked.
   
   This issue also appears on line 595 of the same file.



-- 
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]

Reply via email to