-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HBASE-28106 TestShadeSaslAuthenticationProvider fails for branch-2.x #5433
Conversation
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
t.get(new Get(Bytes.toBytes("r1"))); | ||
fail("Should not successfully authenticate with HBase"); | ||
return null; | ||
// Server will close the connection directly once auth failed, so at client side, we do not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we could add another test for HBase Master API here similar to how it is done in master branch. Could be done as another JIRA also or you could add in current itself.
The following code works:
@Test public void testNegativeAuthentication() throws Exception {
// Validate that we can read that record back out as the user with our custom auth'n
final Configuration clientConf = new Configuration(CONF);
clientConf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 3);
try (Connection conn = ConnectionFactory.createConnection(clientConf)) {
UserGroupInformation user1 =
UserGroupInformation.createUserForTesting("user1", new String[0]);
user1.addToken(
ShadeClientTokenUtil.obtainToken(conn, "user1", "not a real password".toCharArray()));
LOG.info("Executing request to HBase Master which should fail");
user1.doAs(new PrivilegedExceptionAction<Void>() {
@Override public Void run() throws Exception {
try (Connection conn = ConnectionFactory.createConnection(clientConf);) {
conn.getAdmin().listTableDescriptors();
fail("Should not successfully authenticate with HBase");
} catch (Exception e) {
LOG.info("Caught exception in negative Master connectivity test", e);
assertEquals("Found unexpected exception", RetriesExhaustedException.class,
e.getClass());
}
return null;
}
});
LOG.info("Executing request to HBase RegionServer which should fail");
user1.doAs(new PrivilegedExceptionAction<Void>() {
@Override public Void run() throws Exception {
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");
} catch (Exception e) {
LOG.info("Caught exception in negative RegionServer connectivity test", e);
assertEquals("Found unexpected exception", RetriesExhaustedException.class,
e.getClass());
}
return null;
}
});
}
}
Also FYI validateRootCause
method of master fails as here we get 'Connection reset by peer' as message in the RetriesExhaustedException
. Maybe this is expected for branch-2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be another issue, to unify the implementation of this test across different branches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed HBASE-28110.
Overall looks good, +1 |
…5433) Signed-off-by: Nihal Jain <[email protected]> (cherry picked from commit 8d91cd2)
…5433) Signed-off-by: Nihal Jain <[email protected]> (cherry picked from commit 8d91cd2)
…pache#5433) Signed-off-by: Nihal Jain <[email protected]> (cherry picked from commit 8d91cd2) (cherry picked from commit e8aa715) Change-Id: I6b808870868fd5c681d0007d5976a3ea729d8e69
No description provided.