bharathv commented on a change in pull request #1260: HBASE-23881 Ensure Netty
client receives at least one response before…
URL: https://github.com/apache/hbase/pull/1260#discussion_r391952621
##########
File path:
hbase-examples/src/test/java/org/apache/hadoop/hbase/security/provider/example/TestShadeSaslAuthenticationProvider.java
##########
@@ -220,26 +235,114 @@ public void testPositiveAuthentication() throws
Exception {
}
}
- @Test(expected = DoNotRetryIOException.class)
- 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()));
- 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");
+ @Test
+ public void testNegativeMasterAuthentication() throws Exception {
+ List<Pair<String, Class<? extends Exception>>> params = new ArrayList<>();
+ // Master-based connection will fail to ask the master its cluster ID
+ // as a part of creating the Connection.
+ params.add(new Pair<String, Class<? extends Exception>>(
+ MasterRegistry.class.getName(), MasterRegistryFetchException.class));
+ // ZK based connection will fail on the master RPC
+ params.add(new Pair<String, Class<? extends Exception>>(
+ // ZKConnectionRegistry is package-private
+ "org.apache.hadoop.hbase.client.ZKConnectionRegistry",
RetriesExhaustedException.class));
Review comment:
nit: HConstants#ZK_CONNECTION_REGISTRY_CLASS
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services