[ 
https://issues.apache.org/jira/browse/HBASE-23881?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17042112#comment-17042112
 ] 

Bharath Vissapragada commented on HBASE-23881:
----------------------------------------------

Ok.. I should've clarified it a bit better. The test passes now too but I think 
it passes for a wrong reason. The authentication goes through fine but because 
the getTable() throws a different form of DNRIOE (for whatever reason), the 
test passes.

To verify this, I slightly changed the test as follows. I do a 
{{listTableDescriptors()}} on the connection that is supposed to not work.
{noformat}
@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()));
      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");
            return null;
          }
        }
      });
    }
  }
{noformat}
and .. .it fails as follows...
{noformat}
java.lang.AssertionError: Should not successfully authenticate with HBase

        at org.junit.Assert.fail(Assert.java:89)
        at 
org.apache.hadoop.hbase.security.provider.example.TestShadeSaslAuthenticationProvider$3.run(TestShadeSaslAuthenticationProvider.java:237)
        at 
org.apache.hadoop.hbase.security.provider.example.TestShadeSaslAuthenticationProvider$3.run(TestShadeSaslAuthenticationProvider.java:233)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:422)
        at 
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1844)
        at 
org.apache.hadoop.hbase.security.provider.example.TestShadeSaslAuthenticationProvider.testNegativeAuthentication(TestShadeSaslAuthenticationProvider.java:233)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at 
org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
{noformat}

> TestShadeSaslAuthenticationProvider failures
> --------------------------------------------
>
>                 Key: HBASE-23881
>                 URL: https://issues.apache.org/jira/browse/HBASE-23881
>             Project: HBase
>          Issue Type: Bug
>          Components: test
>    Affects Versions: 3.0.0
>            Reporter: Bharath Vissapragada
>            Assignee: Bharath Vissapragada
>            Priority: Major
>
> TestShadeSaslAuthenticationProvider now fails deterministically with the 
> following exception..
> {noformat}
> java.lang.Exception: Unexpected exception, 
> expected<org.apache.hadoop.hbase.DoNotRetryIOException> but 
> was<java.io.IOException>
>       at 
> org.apache.hadoop.hbase.security.provider.example.TestShadeSaslAuthenticationProvider.testNegativeAuthentication(TestShadeSaslAuthenticationProvider.java:233)
> {noformat}
> The test now fails a different place than before merging HBASE-18095 because 
> the RPCs are also a part of connection setup. We might need to rewrite the 
> test..  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to