junegunn commented on code in PR #8002:
URL: https://github.com/apache/hbase/pull/8002#discussion_r3007078485


##########
hbase-server/src/test/java/org/apache/hadoop/hbase/security/TestUsersOperationsWithSecureHadoop.java:
##########
@@ -133,13 +133,14 @@ public void testLoginWithUserKeytabAndPrincipal() throws 
Exception {
   }
 
   @Test
-  public void testAuthUtilLogin() throws Exception {
+  public void testAuthUtilLoginWithExistingLoginUser() throws Exception {
     String clientKeytab = getClientKeytabForTesting();
     String clientPrincipal = getClientPrincipalForTesting();
     Configuration conf = getSecuredConfiguration();
     conf.set(AuthUtil.HBASE_CLIENT_KEYTAB_FILE, clientKeytab);
     conf.set(AuthUtil.HBASE_CLIENT_KERBEROS_PRINCIPAL, clientPrincipal);
     UserGroupInformation.setConfiguration(conf);
+    UserGroupInformation.loginUserFromKeytab(clientPrincipal, clientKeytab);

Review Comment:
   Thanks, this issue has been bothering me for a while, and I can confirm this 
makes the test pass.
   
   However, if we do this, we no longer test if `AuthUtil.loginClient` actually 
performs the login for the user. I think we could create a separate user 
principal, log in as that user, and then test whether ⁠`AuthUtil.loginClient` 
correctly logs in the original user and returns that user.



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

Reply via email to