[ 
https://issues.apache.org/jira/browse/HDFS-16628?focusedWorklogId=780259&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-780259
 ]

ASF GitHub Bot logged work on HDFS-16628:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 10/Jun/22 09:47
            Start Date: 10/Jun/22 09:47
    Worklog Time Spent: 10m 
      Work Description: Hexiaoqiao commented on code in PR #4424:
URL: https://github.com/apache/hadoop/pull/4424#discussion_r894348979


##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterTrash.java:
##########
@@ -189,6 +189,41 @@ public void testMoveToTrashNoMountPoint() throws 
IOException,
     assertEquals(2, fileStatuses.length);
   }
 
+  @Test
+  public void testMoveToTrashNoMountPointWithKerBoersUser() throws IOException,

Review Comment:
   testMoveToTrashNoMountPointWithKerBoersUser -> 
testMoveToTrasWithKerberosUser?
   a. IMO, this case is not related with `NoMountPoint` or not, right?
   b. KerBoers -> Kerberos.



##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterTrash.java:
##########
@@ -189,6 +189,41 @@ public void testMoveToTrashNoMountPoint() throws 
IOException,
     assertEquals(2, fileStatuses.length);
   }
 
+  @Test
+  public void testMoveToTrashNoMountPointWithKerBoersUser() throws IOException,
+      URISyntaxException, InterruptedException {
+    //Constructs the structure of the KerBoers user name
+    String kerBoersUser = "randomUser/[email protected]";

Review Comment:
   Suggest to correct `KerBoers` to `Kerberos`. Both of the following spell 
issues.



##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterTrash.java:
##########
@@ -189,6 +189,41 @@ public void testMoveToTrashNoMountPoint() throws 
IOException,
     assertEquals(2, fileStatuses.length);
   }
 
+  @Test
+  public void testMoveToTrashNoMountPointWithKerBoersUser() throws IOException,
+      URISyntaxException, InterruptedException {
+    //Constructs the structure of the KerBoers user name
+    String kerBoersUser = "randomUser/[email protected]";
+    UserGroupInformation ugi = 
UserGroupInformation.createRemoteUser(kerBoersUser);
+    MountTable addEntry = MountTable.newInstance(MOUNT_POINT,
+        Collections.singletonMap(ns1, MOUNT_POINT));
+    assertTrue(addMountTable(addEntry));
+    // current user client
+    MiniRouterDFSCluster.NamenodeContext nn1Context = cluster.getNamenode(ns1, 
null);
+    DFSClient currentUserClientNs0 = nnContext.getClient();
+    DFSClient currentUserClientNs1 = nn1Context.getClient();
+
+    currentUserClientNs0.setOwner("/", ugi.getShortUserName(), 
ugi.getShortUserName());
+    currentUserClientNs1.setOwner("/", ugi.getShortUserName(), 
ugi.getShortUserName());

Review Comment:
   If only one DFSClient and NamenodeContext is enough for this unit test?



##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterTrash.java:
##########
@@ -189,6 +189,41 @@ public void testMoveToTrashNoMountPoint() throws 
IOException,
     assertEquals(2, fileStatuses.length);
   }
 
+  @Test
+  public void testMoveToTrashNoMountPointWithKerBoersUser() throws IOException,
+      URISyntaxException, InterruptedException {
+    //Constructs the structure of the KerBoers user name
+    String kerBoersUser = "randomUser/[email protected]";
+    UserGroupInformation ugi = 
UserGroupInformation.createRemoteUser(kerBoersUser);
+    MountTable addEntry = MountTable.newInstance(MOUNT_POINT,
+        Collections.singletonMap(ns1, MOUNT_POINT));
+    assertTrue(addMountTable(addEntry));
+    // current user client
+    MiniRouterDFSCluster.NamenodeContext nn1Context = cluster.getNamenode(ns1, 
null);
+    DFSClient currentUserClientNs0 = nnContext.getClient();
+    DFSClient currentUserClientNs1 = nn1Context.getClient();
+
+    currentUserClientNs0.setOwner("/", ugi.getShortUserName(), 
ugi.getShortUserName());
+    currentUserClientNs1.setOwner("/", ugi.getShortUserName(), 
ugi.getShortUserName());
+
+    // test user client
+    DFSClient testUserClientNs1 = nn1Context.getClient(ugi);
+    testUserClientNs1.mkdirs(MOUNT_POINT, new FsPermission("777"), true);
+    assertTrue(testUserClientNs1.exists(MOUNT_POINT));
+    // create test file
+    testUserClientNs1.create(FILE, true);
+    Path filePath = new Path(FILE);
+
+    FileStatus[] fileStatuses = routerFs.listStatus(filePath);
+    assertEquals(1, fileStatuses.length);
+    assertEquals(ugi.getShortUserName(), fileStatuses[0].getOwner());
+    // move to Trash
+    Configuration routerConf = routerContext.getConf();
+    FileSystem fs = DFSTestUtil.getFileSystemAs(ugi, routerConf);
+    Trash trash = new Trash(fs, routerConf);
+    assertTrue(trash.moveToTrash(filePath));

Review Comment:
   Suggest to check if the final trash directory entries are expected: 
`/user/randomUser/.Trash/`?





Issue Time Tracking
-------------------

    Worklog Id:     (was: 780259)
    Time Spent: 0.5h  (was: 20m)

> RBF: kerbose user remove Non-default namespace data failed
> ----------------------------------------------------------
>
>                 Key: HDFS-16628
>                 URL: https://issues.apache.org/jira/browse/HDFS-16628
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: rbf
>    Affects Versions: 3.4.0
>            Reporter: Xiping Zhang
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 3.4.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> remove data from the router will fail using such a user 
> username/[email protected]



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to