bharathv commented on a change in pull request #1102: HBASE-23752: Fix 
remaining test failures from nightly runs
URL: https://github.com/apache/hbase/pull/1102#discussion_r373658126
 
 

 ##########
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/security/provider/TestCustomSaslAuthenticationProvider.java
 ##########
 @@ -527,12 +568,22 @@ public void testNegativeAuthentication() throws 
Exception {
     user1.addToken(createPasswordToken("user1", "definitely not the password", 
clusterId));
     user1.doAs(new PrivilegedExceptionAction<Void>() {
       @Override public Void run() throws Exception {
+        // Depending on the registry in use, the following code can throw 
exceptions at different
+        // places. Master registry fails at the createConnection() step 
because the RPC to the
+        // master fails with sasl auth. With ZK registry, connection creation 
succeeds (since there
+        // is no RPC to HBase services involved) but the subsequent get() 
fails. The root cause
+        // should still be a SaslException in both the cases.
         try (Connection conn = ConnectionFactory.createConnection(clientConf);
             Table t = conn.getTable(tableName)) {
           t.get(new Get(Bytes.toBytes("r1")));
           fail("Should not successfully authenticate with HBase");
-          return null;
+        } catch (MasterRegistryFetchException mfe) {
+          Throwable cause = mfe.getCause();
+          assertTrue(cause.getMessage(), 
cause.getMessage().contains("SaslException"));
+        } catch (RetriesExhaustedException re) {
+          assertTrue(re.getMessage(), 
re.getMessage().contains("SaslException"));
         }
+        return null;
 
 Review comment:
   Okay, added back a nice exception. The issue with moving fail() towards the 
end is that we need sprinkle the "return null" statements in the catch blocks. 
This is more readable IMO.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to