Uploaded image for project: 'Sentry'
  1. Sentry
  2. SENTRY-1910

TestAuthorize.testProduceConsumeCycle() is failing 'No authorized to access topics'

    Details

    • Type: Bug
    • Status: Patch Available
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.0
    • Fix Version/s: None
    • Component/s: Sentry
    • Labels:
      None

      Description

      The following error is seen on the Jenkins job:

      [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)
      

      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.

        Activity

        Hide
        akolb Alexander Kolbasov added a comment -

        Submitting fake patch to test current master

        Show
        akolb Alexander Kolbasov added a comment - Submitting fake patch to test current master
        Hide
        hadoopqa Hadoop QA added a comment -

        Here are the results of testing the latest attachment
        https://issues.apache.org/jira/secure/attachment/12884826/SENTRY-1910.01.patch against master.

        Overall: +1 all checks pass

        SUCCESS: all tests passed

        Console output: https://builds.apache.org/job/PreCommit-SENTRY-Build/3209/console

        This message is automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - Here are the results of testing the latest attachment https://issues.apache.org/jira/secure/attachment/12884826/SENTRY-1910.01.patch against master. Overall: +1 all checks pass SUCCESS: all tests passed Console output: https://builds.apache.org/job/PreCommit-SENTRY-Build/3209/console This message is automatically generated.
        Hide
        spena Sergio Peña added a comment -

        Closing this issue as the test started to pass last night. No idea what was the problem intially. Perhaps an issue with the kafka jars that are solved now?

        Show
        spena Sergio Peña added a comment - Closing this issue as the test started to pass last night. No idea what was the problem intially. Perhaps an issue with the kafka jars that are solved now?
        Hide
        spena Sergio Peña added a comment -

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

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

        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:

        final String localhost = "127.0.0.1";
        

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

        FYI Alexander Kolbasov

        Show
        spena Sergio Peña added a comment - This issue is happening on hive-authz2. I tracked the problem to this line of code: public void testProduceConsumeCycle() throws Exception { LOGGER.debug("testProduceConsumeCycle"); final String localhost = InetAddress.getLocalHost().getHostAddress(); ... 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: final String localhost = "127.0.0.1"; For some reason InetAddress.getLocalHost().getHostAddress() is getting a different localhost value than the one that Sentry detects when kafka connects to it. FYI Alexander Kolbasov
        Hide
        hadoopqa Hadoop QA added a comment -

        Here are the results of testing the latest attachment
        https://issues.apache.org/jira/secure/attachment/12886954/SENTRY-1910.1.patch against master.

        Overall: -1 due to 2 errors

        ERROR: mvn test exited 1
        ERROR: Failed: org.apache.sentry.tests.e2e.kafka.TestAuthorize

        Console output: https://builds.apache.org/job/PreCommit-SENTRY-Build/3289/console

        This message is automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - Here are the results of testing the latest attachment https://issues.apache.org/jira/secure/attachment/12886954/SENTRY-1910.1.patch against master. Overall: -1 due to 2 errors ERROR: mvn test exited 1 ERROR: Failed: org.apache.sentry.tests.e2e.kafka.TestAuthorize Console output: https://builds.apache.org/job/PreCommit-SENTRY-Build/3289/console This message is automatically generated.

          People

          • Assignee:
            spena Sergio Peña
            Reporter:
            spena Sergio Peña
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:

              Development