sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [5/6] sentry git commit: SENTRY-2020: Fix testConsumeCycleWithInsufficientPrivileges test failure in kafka e2e tests.
Date Fri, 27 Oct 2017 09:22:26 GMT
SENTRY-2020: Fix testConsumeCycleWithInsufficientPrivileges test failure in kafka e2e tests.


Project: http://git-wip-us.apache.org/repos/asf/sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/6fa02888
Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/6fa02888
Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/6fa02888

Branch: refs/heads/akolb-cli
Commit: 6fa02888fc6b5bc866f9ece344e03ce95e9ebf86
Parents: 99efc7f
Author: Kalyan Kumar Kalvagadda <kkalyan@cloudera.com>
Authored: Thu Oct 26 12:25:23 2017 -0500
Committer: Kalyan Kumar Kalvagadda <kkalyan@cloudera.com>
Committed: Thu Oct 26 14:05:39 2017 -0500

----------------------------------------------------------------------
 .../tests/e2e/kafka/AbstractKafkaSentryTestBase.java    | 12 ++++++++++++
 .../apache/sentry/tests/e2e/kafka/TestAuthorize.java    |  3 ++-
 2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sentry/blob/6fa02888/sentry-tests/sentry-tests-kafka/src/test/java/org/apache/sentry/tests/e2e/kafka/AbstractKafkaSentryTestBase.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-kafka/src/test/java/org/apache/sentry/tests/e2e/kafka/AbstractKafkaSentryTestBase.java
b/sentry-tests/sentry-tests-kafka/src/test/java/org/apache/sentry/tests/e2e/kafka/AbstractKafkaSentryTestBase.java
index 868d198..33ef8c4 100644
--- a/sentry-tests/sentry-tests-kafka/src/test/java/org/apache/sentry/tests/e2e/kafka/AbstractKafkaSentryTestBase.java
+++ b/sentry-tests/sentry-tests-kafka/src/test/java/org/apache/sentry/tests/e2e/kafka/AbstractKafkaSentryTestBase.java
@@ -204,6 +204,18 @@ public class AbstractKafkaSentryTestBase {
     }
   }
 
+  public static void assertCausedMessages(Exception e, String message1, String message2)
{
+    if (e.getCause() != null) {
+      assertTrue("Expected message: " + message1 + " OR " + message2 ,
+              (e.getCause().getMessage().contains(message1) ||
+                      e.getCause().getMessage().contains(message2)));
+    } else {
+      assertTrue("Expected message: " + message1 + " OR " + message2 + ", but got: " + e.getMessage(),
+              (e.getMessage().contains(message1) ||
+                      e.getMessage().contains(message2)));
+    }
+  }
+
   private static Configuration getClientConfig() {
     Configuration conf = new Configuration();
     /** set the Sentry client configuration for Kafka Service integration */

http://git-wip-us.apache.org/repos/asf/sentry/blob/6fa02888/sentry-tests/sentry-tests-kafka/src/test/java/org/apache/sentry/tests/e2e/kafka/TestAuthorize.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-kafka/src/test/java/org/apache/sentry/tests/e2e/kafka/TestAuthorize.java
b/sentry-tests/sentry-tests-kafka/src/test/java/org/apache/sentry/tests/e2e/kafka/TestAuthorize.java
index d6dfd7a..cc19f64 100644
--- a/sentry-tests/sentry-tests-kafka/src/test/java/org/apache/sentry/tests/e2e/kafka/TestAuthorize.java
+++ b/sentry-tests/sentry-tests-kafka/src/test/java/org/apache/sentry/tests/e2e/kafka/TestAuthorize.java
@@ -281,7 +281,8 @@ public class TestAuthorize extends AbstractKafkaSentryTestBase {
       testConsume(TOPIC_NAME, StaticUserGroupRole.USER_1);
       Assert.fail("user1 must not have been authorized to read consumer group sentrykafkaconsumer.");
     } catch (Exception ex) {
-      assertCausedMessage(ex, "Not authorized to access topics: [" + TOPIC_NAME + "]");
+      assertCausedMessages(ex, "Not authorized to access group: sentrykafkaconsumer",
+              "Not authorized to access topics: [" + TOPIC_NAME + "]");
     }
 
   /*


Mime
View raw message