ChenSammi commented on code in PR #10996:
URL: https://github.com/apache/ozone/pull/10996#discussion_r3763795572


##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyLifecycleService.java:
##########
@@ -3440,6 +3446,65 @@ public void testPartCountLimitedListBoundaryBehavior() {
     assertEquals(0, overList.getPartCount());
   }
 
+  /**
+   * Regression test: KeyLifecycleService must delete keys even when 
ozone.acl.enabled=true.
+   * Before the fix, sendDeleteKeysRequestAndClearList submitted DeleteKeys 
requests without
+   * userInfo (missing preExecute / ugi.doAs), causing UNAUTHORIZED when 
resolveBucketLink
+   * called createUGIForApi() on the blank-userName request. Uses OBJECT_STORE 
layout because
+   * that path calls sendDeleteKeysRequestAndClearList directly (not via 
moveToTrash).
+   */
+  @Nested
+  @TestInstance(TestInstance.Lifecycle.PER_CLASS)
+  class WithAclsEnabled {
+
+    @BeforeAll
+    void setup(@TempDir File testDir) throws Exception {
+      scmBlockTestingClient = new ScmBlockLocationTestingClient(null, null, 0);
+      createConfig(testDir);
+      conf.setBoolean(OZONE_TEST_AUTHORIZATION_ENABLED, true);
+      conf.setBoolean(OZONE_ACL_ENABLED, true);
+      conf.set(OZONE_ACL_AUTHORIZER_CLASS, OZONE_ACL_AUTHORIZER_CLASS_NATIVE);
+      conf.setStrings(OZONE_ADMINISTRATORS, OZONE_ADMINISTRATORS_WILDCARD);
+      createSubject();
+      keyDeletingService.suspend();
+      directoryDeletingService.suspend();
+    }
+
+    @AfterAll
+    void cleanup() {
+      if (om != null) {
+        om.stop();
+        om.join();
+      }
+    }
+
+    @Test
+    void testLifecycleDeleteSucceedsWithAclsEnabled()

Review Comment:
   Could you also add a unit test to cover the moveToTrash case? 



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