You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sentry.apache.org by "Sergio Peña (JIRA)" <ji...@apache.org> on 2017/09/13 20:39:00 UTC

[jira] [Reopened] (SENTRY-1910) TestAuthorize.testProduceConsumeCycle() is failing 'No authorized to access topics'

     [ https://issues.apache.org/jira/browse/SENTRY-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergio Peña reopened SENTRY-1910:
---------------------------------

This issue is happening on hive-authz2. I tracked the problem to this line of code:

{noformat}
  public void testProduceConsumeCycle() throws Exception {
    LOGGER.debug("testProduceConsumeCycle");
    final String localhost = InetAddress.getLocalHost().getHostAddress();
    ...
{noformat}

The {{localhost}} variable is set to {{127.0.1.1}}, and this ip is added to the kafka permissions which are allowed to write messages to kafka.

The problem is after the permissions are added because kafka checks that the ip matches, but the session ip from the unit tests attempting to write to kafka is now {{127.0.0.1}} (no match).

If I changed the variable (see below) then the test works:
{noformat}
final String localhost = "127.0.0.1";
{noformat}

For some reason {{InetAddress.getLocalHost().getHostAddress()}} is getting a different localhost value than the one that Sentry detects when kafka connects to it.

 FYI [~akolb]

> TestAuthorize.testProduceConsumeCycle() is failing 'No authorized to access topics'
> -----------------------------------------------------------------------------------
>
>                 Key: SENTRY-1910
>                 URL: https://issues.apache.org/jira/browse/SENTRY-1910
>             Project: Sentry
>          Issue Type: Bug
>          Components: Sentry
>    Affects Versions: 2.0.0
>            Reporter: Sergio Peña
>
> The following error is seen on the Jenkins job:
> {noformat}
> [ERROR] testProduceConsumeCycle(org.apache.sentry.tests.e2e.kafka.TestAuthorize)  Time elapsed: 0.997 s  <<< FAILURE!
> java.lang.AssertionError:                                          
> user1 should have been able to successfully produce to topic tOpIc1.
>  Exception: java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.TopicAuthorizationException: Not authorized to access topics: [tOpIc1]
>         at org.apache.sentry.tests.e2e.kafka.TestAuthorize.testProduceConsumeCycle(TestAuthorize.java:123)
> {noformat}
> I went back several commits to see if this test was working, but it also fails in the same way. It is weird because the master branch was working correctly before.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)