joshelser 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_r373618989
########## 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: You're right that the thrown, uncaught exception will ultimately cause the test to fail, but you're removing the nice exception stating the reason the test failed :) ---------------------------------------------------------------- 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