You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jo...@apache.org on 2019/04/12 00:40:44 UTC

[impala] 03/03: IMPALA-8365: Add test coverage for running Impala with Ranger on local catalog mode

This is an automated email from the ASF dual-hosted git repository.

joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 8a859af16b45ad14360616f99275057591668748
Author: Fredy Wijaya <fw...@cloudera.com>
AuthorDate: Wed Apr 10 14:48:09 2019 -0700

    IMPALA-8365: Add test coverage for running Impala with Ranger on local catalog mode
    
    This patch adds a test coverage for running Impala with Ranger on local
    catalog mode to make sure there is no regression introduced in local
    catlaog when running Impala with Ranger.
    
    Testing:
    - Added missing E2E test in test_ranger.py
    
    Change-Id: Ib2bcd7876e569e505cae7cf623496dad2b66518b
    Reviewed-on: http://gerrit.cloudera.org:8080/12989
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 tests/authorization/test_ranger.py | 40 ++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/tests/authorization/test_ranger.py b/tests/authorization/test_ranger.py
index a8ebb90..dc33c30 100644
--- a/tests/authorization/test_ranger.py
+++ b/tests/authorization/test_ranger.py
@@ -28,6 +28,12 @@ from tests.common.custom_cluster_test_suite import CustomClusterTestSuite
 
 RANGER_AUTH = ("admin", "admin")
 RANGER_HOST = "http://localhost:6080"
+IMPALAD_ARGS = "--server-name=server1 --ranger_service_type=hive " \
+               "--ranger_app_id=impala --authorization_factory_class=" \
+               "org.apache.impala.authorization.ranger.RangerAuthorizationFactory"
+CATALOGD_ARGS = "--server-name=server1 --ranger_service_type=hive " \
+                "--ranger_app_id=impala --authorization_factory_class=" \
+                "org.apache.impala.authorization.ranger.RangerAuthorizationFactory"
 
 
 class TestRanger(CustomClusterTestSuite):
@@ -36,15 +42,22 @@ class TestRanger(CustomClusterTestSuite):
   """
   @pytest.mark.execute_serially
   @CustomClusterTestSuite.with_args(
-    impalad_args="--server-name=server1 --ranger_service_type=hive "
-                 "--ranger_app_id=impala "
-                 "--authorization_factory_class="
-                 "org.apache.impala.authorization.ranger.RangerAuthorizationFactory",
-    catalogd_args="--server-name=server1 --ranger_service_type=hive "
-                  "--ranger_app_id=impala "
-                  "--authorization_factory_class="
-                  "org.apache.impala.authorization.ranger.RangerAuthorizationFactory")
-  def test_grant_revoke(self, unique_name):
+      impalad_args=IMPALAD_ARGS, catalogd_args=CATALOGD_ARGS)
+  def test_grant_revoke_with_catalog_v1(self, unique_name):
+    """Tests grant/revoke with catalog v1."""
+    self._test_grant_revoke(unique_name)
+
+  @pytest.mark.execute_serially
+  @CustomClusterTestSuite.with_args(
+      impalad_args="{0} {1}".format(IMPALAD_ARGS, "--use_local_catalog=true"),
+      catalogd_args="{0} {1}".format(CATALOGD_ARGS,
+                                     "--use_local_catalog=true "
+                                     "--catalog_topic_mode=minimal"))
+  def test_grant_revoke_with_local_catalog(self, unique_name):
+    """Tests grant/revoke with catalog v2 (local catalog)."""
+    self._test_grant_revoke(unique_name)
+
+  def _test_grant_revoke(self, unique_name):
     user = getuser()
     admin = "admin"
     admin_client = self.create_impala_client()
@@ -88,14 +101,7 @@ class TestRanger(CustomClusterTestSuite):
                              .format(unique_database), user=admin)
 
   @CustomClusterTestSuite.with_args(
-    impalad_args="--server-name=server1 --ranger_service_type=hive "
-                 "--ranger_app_id=impala "
-                 "--authorization_factory_class="
-                 "org.apache.impala.authorization.ranger.RangerAuthorizationFactory",
-    catalogd_args="--server-name=server1 --ranger_service_type=hive "
-                  "--ranger_app_id=impala "
-                  "--authorization_factory_class="
-                  "org.apache.impala.authorization.ranger.RangerAuthorizationFactory")
+      impalad_args=IMPALAD_ARGS, catalogd_args=CATALOGD_ARGS)
   def test_grant_option(self, unique_name):
     user1 = getuser()
     user2 = unique_name + "_user"