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 2020/05/02 02:29:55 UTC

[impala] 02/02: IMPALA-9649: Exclude shiro* and add to banned dependency maven plugin

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 53ff6f9bf5ca907f15ec1187eb5d4007d46eb61e
Author: David Knupp <dk...@cloudera.com>
AuthorDate: Thu Apr 23 17:06:42 2020 -0700

    IMPALA-9649: Exclude shiro* and add to banned dependency maven plugin
    
    The earlier attempt to exclude the shiro-core and shiro-crypto-cipher jars
    from fe/pom.xml failed to find all instances, and security scans picked
    them up again. This patch also excludes the jar from the following:
    
    - sentry-core-common
    - sentry-provider-cache
    - sentry-provider-db
    - sentry-provider-file
    
    Furthermore, to avoid compilation errors related to the absense of shiro, it
    was necessary to remove the TestSentryResourceAuthorizationProvider class,
    and any tests that referenced it. Since Sentry is not being used any longer,
    this shouldn't be an issue.
    
    Tested by running build, which didn't fail from banned dependency plugin,
    as well running the standard set of tests on jenkins.impala.io.
    
    Change-Id: I9f9994bf81c1d2e025a03925e8eccb147c34d66e
    Reviewed-on: http://gerrit.cloudera.org:8080/15796
    Reviewed-by: Joe McDonnell <jo...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 fe/pom.xml                                         |  50 +-
 .../impala/authorization/AuthorizationTest.java    | 111 ----
 .../TestSentryResourceAuthorizationProvider.java   |  36 --
 tests/authorization/test_authorization.py          |  29 --
 tests/authorization/test_grant_revoke.py           |  47 --
 tests/authorization/test_owner_privileges.py       | 571 ---------------------
 tests/authorization/test_sentry.py                 |  53 --
 tests/authorization/test_show_grant.py             | 150 ------
 8 files changed, 43 insertions(+), 1004 deletions(-)

diff --git a/fe/pom.xml b/fe/pom.xml
index 61e26a2..94c0cf8 100644
--- a/fe/pom.xml
+++ b/fe/pom.xml
@@ -192,10 +192,17 @@ under the License.
     </dependency>
 
     <dependency>
+      <groupId>org.apache.impala</groupId>
+      <artifactId>yarn-extras</artifactId>
+      <version>${yarn-extras.version}</version>
+    </dependency>
+
+    <dependency>
       <groupId>org.apache.sentry</groupId>
       <artifactId>sentry-core-common</artifactId>
       <version>${sentry.version}</version>
       <exclusions>
+        <!-- https://issues.apache.org/jira/browse/IMPALA-9649 -->
         <exclusion>
           <groupId>org.apache.shiro</groupId>
           <artifactId>shiro-crypto-cipher</artifactId>
@@ -208,12 +215,6 @@ under the License.
     </dependency>
 
     <dependency>
-      <groupId>org.apache.impala</groupId>
-      <artifactId>yarn-extras</artifactId>
-      <version>${yarn-extras.version}</version>
-    </dependency>
-
-    <dependency>
       <groupId>org.apache.sentry</groupId>
       <artifactId>sentry-core-model-db</artifactId>
       <version>${sentry.version}</version>
@@ -237,6 +238,16 @@ under the License.
       <artifactId>sentry-provider-db</artifactId>
       <version>${sentry.version}</version>
       <exclusions>
+        <!-- https://issues.apache.org/jira/browse/IMPALA-9649 -->
+        <exclusion>
+          <groupId>org.apache.shiro</groupId>
+          <artifactId>shiro-crypto-cipher</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.shiro</groupId>
+          <artifactId>shiro-core</artifactId>
+        </exclusion>
+
         <!-- https://issues.apache.org/jira/browse/HADOOP-14903 -->
         <exclusion>
           <groupId>net.minidev</groupId>
@@ -269,6 +280,17 @@ under the License.
       <groupId>org.apache.sentry</groupId>
       <artifactId>sentry-provider-file</artifactId>
       <version>${sentry.version}</version>
+      <exclusions>
+        <!-- https://issues.apache.org/jira/browse/IMPALA-9649 -->
+        <exclusion>
+          <groupId>org.apache.shiro</groupId>
+          <artifactId>shiro-crypto-cipher</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.shiro</groupId>
+          <artifactId>shiro-core</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
 
     <dependency>
@@ -276,6 +298,16 @@ under the License.
       <artifactId>sentry-provider-cache</artifactId>
       <version>${sentry.version}</version>
       <exclusions>
+        <!-- https://issues.apache.org/jira/browse/IMPALA-9649 -->
+        <exclusion>
+          <groupId>org.apache.shiro</groupId>
+          <artifactId>shiro-crypto-cipher</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.shiro</groupId>
+          <artifactId>shiro-core</artifactId>
+        </exclusion>
+
         <!-- https://issues.apache.org/jira/browse/HADOOP-14903 -->
         <exclusion>
           <groupId>net.minidev</groupId>
@@ -349,7 +381,7 @@ under the License.
           <groupId>org.apache.hadoop</groupId>
           <artifactId>hadoop-common</artifactId>
         </exclusion>
-       <exclusion>
+        <exclusion>
           <groupId>org.apache.hive</groupId>
           <artifactId>*</artifactId>
         </exclusion>
@@ -758,6 +790,9 @@ under the License.
                     <exclude>org.fusesource.leveldbjni:*</exclude>
                     <!-- IMPALA-9647 (re: CVE-2014-3577, CVE-2015-5262) -->
                     <exclude>org.apache.httpcomponents:fluent-hc</exclude>
+                    <!-- IMPALA-9649 (Avoid pulling in shiro* due to CVE's) -->
+                    <exclude>org.apache.shiro:shiro-core:*</exclude>
+                    <exclude>org.apache.shiro:shiro-crypto-cipher:*</exclude>
                     <!-- Assert that we only use artifacts from only the specified
                          version of these components. -->
                     <exclude>org.apache.hadoop:*</exclude>
@@ -1380,6 +1415,7 @@ under the License.
         <artifactId>javax.el</artifactId>
         <version>3.0.1-b08</version>
       </dependency>
+
     </dependencies>
   </dependencyManagement>
 </project>
diff --git a/fe/src/test/java/org/apache/impala/authorization/AuthorizationTest.java b/fe/src/test/java/org/apache/impala/authorization/AuthorizationTest.java
index 620246f..fda304d 100644
--- a/fe/src/test/java/org/apache/impala/authorization/AuthorizationTest.java
+++ b/fe/src/test/java/org/apache/impala/authorization/AuthorizationTest.java
@@ -46,7 +46,6 @@ import org.apache.impala.common.ImpalaException;
 import org.apache.impala.common.InternalException;
 import org.apache.impala.common.RuntimeEnv;
 import org.apache.impala.testutil.TestSentryGroupMapper;
-import org.apache.impala.testutil.TestSentryResourceAuthorizationProvider;
 import org.apache.impala.service.Frontend;
 import org.apache.impala.testutil.ImpaladTestCatalog;
 import org.apache.impala.thrift.TMetadataOpRequest;
@@ -519,79 +518,6 @@ public class AuthorizationTest extends FrontendTestBase {
   }
 
   @Test
-  public void TestShortUsernameWithAuthToLocal() throws ImpalaException {
-    // We load the auth_to_local configs from core-site.xml in the test mode even if
-    // kerberos is disabled. We use the following configuration for tests
-    //   <property>
-    //     <name>hadoop.security.auth_to_local</name>
-    //     <value>RULE:[2:$1@$0](authtest@REALM.COM)s/(.*)@REALM.COM/auth_to_local_user/
-    //       RULE:[1:$1]
-    //       RULE:[2:$1]
-    //       DEFAULT
-    //     </value>
-    //   </property>
-    SentryAuthorizationConfig authzConfig = new SentryAuthorizationConfig("server1",
-       AuthorizationTest.AUTHZ_CONFIG.getSentryConfig().getConfigFile(),
-        TestSentryResourceAuthorizationProvider.class.getName());
-    SentryAuthorizationFactory authzFactory = new SentryAuthorizationFactory(
-        authzConfig);
-    try (ImpaladTestCatalog catalog = new ImpaladTestCatalog(authzFactory)) {
-      setupImpalaCatalog(catalog);
-      // This test relies on the auth_to_local rule -
-      // "RULE:[2:$1@$0](authtest@REALM.COM)s/(.*)@REALM.COM/auth_to_local_user/"
-      // which converts any principal of type authtest/<hostname>@REALM.COM to user
-      // auth_to_local_user. We have a sentry privilege in place that grants 'SELECT'
-      // privilege on tpcds.* to user auth_to_local_user. To test the integration, we try
-      // running the query with authtest/hostname@REALM.COM user which is converted to
-      // user 'auth_to_local_user' and the authz should pass.
-      User.setRulesForTesting(
-          new Configuration().get(HADOOP_SECURITY_AUTH_TO_LOCAL, "DEFAULT"));
-      User user = new User("authtest/hostname@REALM.COM");
-      AnalysisContext ctx = createAnalysisCtx(authzFactory, user.getName());
-      Frontend fe = new Frontend(authzFactory, catalog);
-
-      // Can select from table that user has privileges on.
-      AuthzOk(fe, ctx, "select * from tpcds.customer");
-      // Does not have privileges to execute a query
-      AuthzError(fe, ctx, "select * from functional.alltypes",
-          "User '%s' does not have privileges to execute 'SELECT' on: " +
-              "functional.alltypes");
-
-      // Unit tests for User#getShortName()
-      // Different auth_to_local rules to apply on the username.
-      List<String> rules = Lists.newArrayList(
-          // Expects user@REALM and returns 'usera' (appends a in the end)
-          "RULE:[1:$1@$0](.*@REALM.COM)s/(.*)@REALM.COM/$1a/g",
-          // Same as above but expects user/host@REALM
-          "RULE:[2:$1@$0](.*@REALM.COM)s/(.*)@REALM.COM/$1a/g");
-
-      // Map from the user to the expected getShortName() output after applying
-      // the corresponding rule from 'rules' list.
-      List<Map.Entry<User, String>> users = Lists.newArrayList(
-          Maps.immutableEntry(new User(USER.getName() + "@REALM.COM"), USER.getName()
-              + "a"),
-          Maps.immutableEntry(new User(USER.getName() + "/abc.host.com@REALM.COM"),
-              USER.getName() + "a"));
-
-      for (int idx = 0; idx < users.size(); ++idx) {
-        Map.Entry<User, String> userObj = users.get(idx);
-        assertEquals(userObj.getKey().getShortNameForTesting(rules.get(idx)),
-            userObj.getValue());
-      }
-
-      // Test malformed rules. RuleParser throws an IllegalArgumentException.
-      String malformedRule = "{((()";
-      try {
-        user.getShortNameForTesting(malformedRule);
-      } catch (IllegalArgumentException e) {
-        Assert.assertTrue(e.getMessage().contains("Invalid rule"));
-        return;
-      }
-      Assert.fail("No exception caught while using getShortName() on a malformed rule");
-    }
-  }
-
-  @Test
   public void TestConfigValidation() throws InternalException {
     String sentryConfig = AUTHZ_CONFIG.getSentryConfig().getConfigFile();
     // Valid configs pass validation.
@@ -681,43 +607,6 @@ public class AuthorizationTest extends FrontendTestBase {
     Assert.assertFalse(config.isEnabled());
   }
 
-  @Test
-  public void TestLocalGroupPolicyProvider() throws ImpalaException {
-    // Use an authorization configuration that uses the
-    // CustomClusterResourceAuthorizationProvider.
-    SentryAuthorizationConfig authzConfig = new SentryAuthorizationConfig("server1",
-        AuthorizationTest.AUTHZ_CONFIG.getSentryConfig().getConfigFile(),
-        TestSentryResourceAuthorizationProvider.class.getName());
-    SentryAuthorizationFactory authzFactory = new SentryAuthorizationFactory(authzConfig);
-    try (ImpaladTestCatalog catalog = new ImpaladTestCatalog(authzFactory)) {
-      setupImpalaCatalog(catalog);
-      // Create an analysis context + FE with the test user
-      // (as defined in the policy file)
-      User user = new User("test_user");
-      AnalysisContext ctx = createAnalysisCtx(authzFactory, user.getName());
-      Frontend fe = new Frontend(authzFactory, catalog);
-
-      // Can select from table that user has privileges on.
-      AuthzOk(fe, ctx, "select * from functional.alltypesagg");
-      // Does not have privileges to execute a query
-      AuthzError(fe, ctx, "select * from functional.alltypes",
-          "User '%s' does not have privileges to execute 'SELECT' on: " +
-              "functional.alltypes");
-
-      // Verify with the admin user
-      user = new User("admin_user");
-      ctx = createAnalysisCtx(authzFactory, user.getName());
-      fe = new Frontend(authzFactory, catalog);
-
-      // Admin user should have privileges to do anything
-      AuthzOk(fe, ctx, "select * from functional.alltypesagg");
-      AuthzOk(fe, ctx, "select * from functional.alltypes");
-      AuthzOk(fe, ctx, "invalidate metadata");
-      AuthzOk(fe, ctx, "create external table tpch.kudu_tbl stored as kudu " +
-          "TBLPROPERTIES ('kudu.master_addresses'='127.0.0.1', 'kudu.table_name'='tbl')");
-    }
-  }
-
   private void TestWithIncorrectConfig(AuthorizationConfig authzConfig, User user)
       throws ImpalaException {
     SentryAuthorizationFactory authzFactory = new SentryAuthorizationFactory(authzConfig);
diff --git a/fe/src/test/java/org/apache/impala/testutil/TestSentryResourceAuthorizationProvider.java b/fe/src/test/java/org/apache/impala/testutil/TestSentryResourceAuthorizationProvider.java
deleted file mode 100644
index a1097bb..0000000
--- a/fe/src/test/java/org/apache/impala/testutil/TestSentryResourceAuthorizationProvider.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package org.apache.impala.testutil;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.sentry.core.common.Model;
-import org.apache.sentry.policy.common.PolicyEngine;
-import org.apache.sentry.provider.common.ResourceAuthorizationProvider;
-
-public class TestSentryResourceAuthorizationProvider
-    extends ResourceAuthorizationProvider {
-  public TestSentryResourceAuthorizationProvider(String resource, PolicyEngine policy,
-      Model model) {
-    super(policy, new TestSentryGroupMapper(), model);
-  }
-
-  public TestSentryResourceAuthorizationProvider(Configuration conf, String resource,
-      PolicyEngine policy, Model model) {
-    super(policy, new TestSentryGroupMapper(), model);
-  }
-}
diff --git a/tests/authorization/test_authorization.py b/tests/authorization/test_authorization.py
index 83dd0b6..3459f5c 100644
--- a/tests/authorization/test_authorization.py
+++ b/tests/authorization/test_authorization.py
@@ -98,35 +98,6 @@ class TestAuthorization(CustomClusterTestSuite):
   @pytest.mark.execute_serially
   @CustomClusterTestSuite.with_args(
       impalad_args="--server_name=server1 "
-                   "--sentry_config={0} "
-                   "--authorization_policy_provider_class="
-                   "org.apache.impala.testutil.TestSentryResourceAuthorizationProvider"
-                   .format(SENTRY_CONFIG_FILE),
-      catalogd_args="--sentry_config={0} "
-                    "--authorization_policy_provider_class="
-                    "org.apache.impala.testutil.TestSentryResourceAuthorizationProvider"
-                    .format(SENTRY_CONFIG_FILE),
-      sentry_config=SENTRY_CONFIG_FILE)
-  def test_custom_authorization_provider(self, unique_role):
-    try:
-      self.session_handle = self.__open_hs2(getuser(), dict()).sessionHandle
-      self.__execute_hs2_stmt("create role {0}".format(unique_role))
-      self.__execute_hs2_stmt("grant role {0} to group {1}"
-                              .format(unique_role, grp.getgrnam(getuser()).gr_name))
-      self.__execute_hs2_stmt("grant select on table tpch.lineitem to role {0}"
-                              .format(unique_role))
-
-      bad_resp = self.__execute_hs2_stmt("describe tpch_seq.lineitem", False)
-      assert 'User \'%s\' does not have privileges to access' % getuser() in \
-             str(bad_resp)
-      self.__execute_hs2_stmt("describe tpch.lineitem")
-    finally:
-      self.__execute_hs2_stmt("drop role {0}".format(unique_role))
-
-  @SkipIf.sentry_disabled
-  @pytest.mark.execute_serially
-  @CustomClusterTestSuite.with_args(
-      impalad_args="--server_name=server1 "
                    "--authorized_proxy_user_config=hue={0}".format(getuser()),
       catalogd_args="--sentry_config=" + SENTRY_CONFIG_FILE,
       sentry_config=SENTRY_CONFIG_FILE)
diff --git a/tests/authorization/test_grant_revoke.py b/tests/authorization/test_grant_revoke.py
index 6b3fd30..5bd4895 100644
--- a/tests/authorization/test_grant_revoke.py
+++ b/tests/authorization/test_grant_revoke.py
@@ -340,53 +340,6 @@ class TestGrantRevoke(SentryCacheTestSuite):
 
   @pytest.mark.execute_serially
   @SentryCacheTestSuite.with_args(
-      impalad_args="--server_name=server1 --sentry_config={0} "
-                   "--authorization_policy_provider_class="
-                   "org.apache.impala.testutil.TestSentryResourceAuthorizationProvider"
-                   .format(SENTRY_CONFIG_FILE_OO),
-      catalogd_args="--sentry_config={0} "
-                    "--authorization_policy_provider_class="
-                    "org.apache.impala.testutil.TestSentryResourceAuthorizationProvider"
-                    .format(SENTRY_CONFIG_FILE_OO),
-      sentry_config=SENTRY_CONFIG_FILE_OO)
-  def test_same_name_for_role_and_user_invalidate_metadata(self, unique_name):
-    """IMPALA-7729: Tests running invalidate metadata with for the same name for both
-    user and role should not cause Impala query to hang."""
-    db_prefix = unique_name
-    role_name = "foobar"
-    # Use two different clients so that the sessions will use two different user names.
-    foobar_impalad_client = self.create_impala_client()
-    FOOBAR_impalad_client = self.create_impala_client()
-    try:
-      # This will create "foobar" role catalog object.
-      self.client.execute("create role {0}".format(role_name))
-      self.client.execute("grant all on server to {0}".format(role_name))
-      self.client.execute("grant role {0} to group `{1}`".format(
-          role_name, grp.getgrnam(getuser()).gr_name))
-      self.client.execute("grant role {0} to group foobar".format(role_name))
-      self.client.execute("grant role {0} to group FOOBAR".format(role_name))
-
-      # User names are case sensitive, so "foobar" and "FOOBAR" users should be treated
-      # as two different catalog objects.
-
-      # This will create "foobar" user catalog object.
-      self.user_query(foobar_impalad_client, "create database {0}_db1"
-                      .format(db_prefix), user="foobar")
-      # This will create "FOOBAR" user catalog object.
-      self.user_query(FOOBAR_impalad_client, "create database {0}_db2"
-                      .format(db_prefix), user="FOOBAR")
-
-      # Verify that running invalidate metadata won't hang due to having the same name
-      # in both user and role.
-      handle = self.client.execute_async("invalidate metadata")
-      assert self.client.wait_for_finished_timeout(handle, timeout=60)
-    finally:
-      self.client.execute("drop database {0}_db1".format(db_prefix))
-      self.client.execute("drop database {0}_db2".format(db_prefix))
-      self.client.execute("drop role {0}".format(role_name))
-
-  @pytest.mark.execute_serially
-  @SentryCacheTestSuite.with_args(
       impalad_args="--server_name=server1",
       catalogd_args="--sentry_config={0}".format(SENTRY_CONFIG_FILE),
       sentry_config=SENTRY_CONFIG_FILE)
diff --git a/tests/authorization/test_owner_privileges.py b/tests/authorization/test_owner_privileges.py
deleted file mode 100644
index 1ee3df5..0000000
--- a/tests/authorization/test_owner_privileges.py
+++ /dev/null
@@ -1,571 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-# Client tests to ensure object ownership functionality.
-
-import grp
-import pytest
-from getpass import getuser
-from os import getenv
-
-from tests.common.sentry_cache_test_suite import SentryCacheTestSuite, TestObject
-from tests.common.test_dimensions import create_uncompressed_text_dimension
-from tests.common.skip import SkipIf, SkipIfHive3
-from tests.util.filesystem_utils import FILESYSTEM_PREFIX
-
-# Sentry long polling frequency to make Sentry refresh not run.
-SENTRY_LONG_POLLING_FREQUENCY_S = 3600
-
-SENTRY_CONFIG_DIR = getenv('IMPALA_HOME') + '/fe/src/test/resources/'
-SENTRY_BASE_LOG_DIR = getenv('IMPALA_CLUSTER_LOGS_DIR') + "/sentry"
-SENTRY_CONFIG_FILE_OO = SENTRY_CONFIG_DIR + 'sentry-site_oo.xml'
-SENTRY_CONFIG_FILE_OO_NOGRANT = SENTRY_CONFIG_DIR + 'sentry-site_oo_nogrant.xml'
-SENTRY_CONFIG_FILE_NO_OO = SENTRY_CONFIG_DIR + 'sentry-site_no_oo.xml'
-
-
-@SkipIf.sentry_disabled
-@SkipIfHive3.sentry_not_supported
-class TestOwnerPrivileges(SentryCacheTestSuite):
-  @classmethod
-  def add_test_dimensions(cls):
-    super(TestOwnerPrivileges, cls).add_test_dimensions()
-    cls.ImpalaTestMatrix.add_dimension(
-      create_uncompressed_text_dimension(cls.get_workload()))
-
-  def teardown_class(self):
-    super(self)
-
-  def setup_method(self, method):
-    super(TestOwnerPrivileges, self).setup_method(method)
-    self._setup_admin()
-
-  def teardown_method(self, method):
-    self._cleanup_admin()
-    super(TestOwnerPrivileges, self).teardown_method(method)
-
-  def _setup_ownership_test(self):
-    self._cleanup_ownership_test()
-    # Base roles for enabling tests.
-    self.execute_query("create role owner_priv_test_oo_user1")
-    # Role for verifying grant.
-    self.execute_query("create role owner_priv_test_all_role")
-    # Role for verifying transfer to role.
-    self.execute_query("create role owner_priv_test_owner_role")
-    self.execute_query("grant role owner_priv_test_oo_user1 to group oo_group1")
-    self.execute_query("grant role owner_priv_test_owner_role to group oo_group1")
-    self.execute_query("grant create on server to owner_priv_test_oo_user1")
-    self.execute_query("grant select on database functional to owner_priv_test_oo_user1")
-
-  def _cleanup_ownership_test(self):
-    # Clean up the test artifacts.
-    try:
-      self.cleanup_db("owner_priv_db", sync_ddl=0)
-    except Exception:
-      # Ignore this if we can't show tables.
-      pass
-
-    # Clean up any old roles created by this test
-    for role_name in self.execute_query("show roles").data:
-      if "owner_priv_test" in role_name:
-        self.execute_query("drop role %s" % role_name)
-
-  @staticmethod
-  def count_user_privileges(result):
-    """
-    This method returns a new list of privileges that only contain user privileges.
-    """
-    # results should have the following columns
-    # principal_name, principal_type, scope, database, table, column, uri, privilege,
-    # grant_option, create_time
-    total = 0
-    for row in result.data:
-      col = row.split('\t')
-      if col[0] == 'USER':
-        total += 1
-    return total
-
-  def _validate_no_user_privileges(self, client, user, refresh_authorization):
-    if refresh_authorization: self.execute_query("refresh authorization")
-    result = self.user_query(client, "show grant user %s" % user, user=user)
-    return TestOwnerPrivileges.count_user_privileges(result) == 0
-
-  def _setup_admin(self):
-    # Admin for manipulation and cleaning up.
-    try:
-      self.execute_query("drop role owner_priv_admin")
-    except Exception:
-      # Ignore in case it wasn't created yet.
-      pass
-    self.execute_query("create role owner_priv_admin")
-    self.execute_query("grant all on server to owner_priv_admin with grant option")
-    group_name = grp.getgrnam(getuser()).gr_name
-    self.execute_query("grant role owner_priv_admin to group `%s`" % group_name)
-
-  def _cleanup_admin(self):
-    self.execute_query("drop role owner_priv_admin")
-
-  @pytest.mark.execute_serially
-  @SentryCacheTestSuite.with_args(
-      impalad_args="--server_name=server1 --sentry_config={0} "
-                   "--authorization_policy_provider_class="
-                   "org.apache.impala.testutil.TestSentryResourceAuthorizationProvider"
-                   .format(SENTRY_CONFIG_FILE_OO),
-      catalogd_args="--sentry_config={0} --sentry_catalog_polling_frequency_s={1} "
-                    "--authorization_policy_provider_class="
-                    "org.apache.impala.testutil.TestSentryResourceAuthorizationProvider"
-                    .format(SENTRY_CONFIG_FILE_OO, SENTRY_LONG_POLLING_FREQUENCY_S),
-      sentry_config=SENTRY_CONFIG_FILE_OO,
-      sentry_log_dir="{0}/test_drop_table_if_exists".format(SENTRY_BASE_LOG_DIR))
-  def test_drop_if_exists(self, vector, unique_database):
-    try:
-      # we need to use a separate db for testing the drop database if exists case
-      # For others we can rely on using unique_database which gets cleaned up
-      # automatically
-      test_db = "test_drop_if_exists_db"
-      self._setup_drop_if_exist_test(unique_database, test_db)
-      self._execute_drop_if_exists(TestObject(TestObject.DATABASE, test_db))
-      self._execute_drop_if_exists(TestObject(TestObject.TABLE, unique_database +
-          ".test_table"))
-      self._execute_drop_if_exists(TestObject(TestObject.VIEW, unique_database +
-          ".test_view"))
-      self._execute_drop_if_exists(TestObject(TestObject.FUNCTION, unique_database +
-          ".test_func()"))
-    finally:
-      self._cleanup_drop_if_exist_test(test_db)
-
-  def _setup_drop_if_exist_test(self, unique_database, test_db):
-    # Cleanup test_db, as the previous test run may have not been able to clean it up
-    self.execute_query("drop database if exists %s" % test_db)
-
-    # create a role which can create objects on this server
-    # for the purposes of this test oo_user1 will have privileges
-    # to create (and drop) objects while oo_user_2 will not have drop privileges
-    # oo_user_3 will have privileges to select on the server but not to drop
-    for role_name in self.execute_query("show roles").data:
-      if role_name in ['oo_user1_role', 'oo_user2_role', 'oo_user3_role']:
-        self.execute_query("drop role {0}".format(role_name))
-
-    self.execute_query("create role oo_user1_role")
-    self.execute_query("create role oo_user2_role")
-    self.execute_query("create role oo_user3_role")
-    # grant create permissions to oo_user_1 so that they can create database/table
-    # or functions
-    self.execute_query("grant create on server to oo_user1_role")
-    # grant select permissions to oo_user_3 so that they can use database/table
-    # or functions, but cannot drop them
-    self.execute_query("grant select on server to oo_user3_role")
-    # oo_user1 needs permissions to create a view based of functional.alltypes
-    self.execute_query("grant select on database functional to oo_user1_role")
-    # oo_user1 needs permissions to create a function based of libTestUdfs.so
-    self.execute_query("grant all on uri '{0}/test-warehouse/libTestUdfs.so' to"
-        " oo_user1_role".format(FILESYSTEM_PREFIX))
-    # We need to provide explicit privileges to drop functions
-    self.execute_query("grant drop on database {0} to "
-        "oo_user1_role".format(unique_database))
-    self.execute_query("grant role oo_user1_role to group oo_group1")
-    self.execute_query("grant role oo_user2_role to group oo_group2")
-    self.execute_query("grant role oo_user3_role to group oo_group3")
-    self.execute_query("refresh authorization")
-
-  def _cleanup_drop_if_exist_test(self, test_db):
-    self.execute_query("revoke role oo_user1_role from group oo_group1")
-    self.execute_query("revoke role oo_user2_role from group oo_group2")
-    self.execute_query("revoke role oo_user3_role from group oo_group3")
-    self.execute_query("drop role oo_user1_role")
-    self.execute_query("drop role oo_user2_role")
-    self.execute_query("drop role oo_user3_role")
-    self.execute_query("refresh authorization")
-    self.execute_query("drop database if exists {0}".format(test_db))
-
-  def _execute_drop_if_exists(self, test_obj):
-    self._execute_drop_if_exists_inner(test_obj, True)
-    if test_obj.obj_type != TestObject.DATABASE:
-      self._execute_drop_if_exists_inner(test_obj, False)
-
-  def _execute_drop_if_exists_inner(self, test_obj, use_qualified_name):
-    """
-    Executes a drop table if exists on a given object type and makes sure that
-    there is no authorization exception when the user has enough privileges. If the user
-    does not have correct privileges the test confirms that error is thrown
-    """
-    self.oo_user1_impalad_client = self.create_impala_client()
-    self.oo_user2_impalad_client = self.create_impala_client()
-    self.oo_user3_impalad_client = self.create_impala_client()
-
-    fq_obj_name = test_obj.obj_name
-    obj_name = fq_obj_name if use_qualified_name else test_obj.table_name
-    if not use_qualified_name:
-       # Call "use db" and omit "db." in the queries of oo_user1 and oo_user3
-       # oo_user2 has no privileges for the database so it will always use qualified name
-       self.user_query(self.oo_user1_impalad_client, "use %s" % test_obj.db_name,
-                       user="oo_user1")
-       self.user_query(self.oo_user3_impalad_client, "use %s" % test_obj.db_name,
-                       user="oo_user3")
-
-    self.user_query(self.oo_user1_impalad_client, "create %s %s %s %s %s" %
-                    (test_obj.obj_type, test_obj.obj_name, test_obj.table_def,
-                     test_obj.view_select, test_obj.func_def), user="oo_user1")
-
-    access_error_msg = \
-        "does not have privileges to ANY" if test_obj.obj_type == TestObject.FUNCTION \
-        else "does not have privileges to access"
-    drop_error_msg = \
-        "does not have privileges to DROP" if test_obj.obj_type == TestObject.FUNCTION \
-        else "does not have privileges to execute 'DROP'"
-
-    # Try to DROP IF EXISTS an existing object without DROP privileges
-    self.user_query(self.oo_user2_impalad_client, "drop %s if exists %s" %
-                    (test_obj.obj_type, fq_obj_name), user="oo_user2,",
-                    error_msg=access_error_msg)
-    self.user_query(self.oo_user3_impalad_client, "drop %s if exists %s" %
-                    (test_obj.obj_type, obj_name), user="oo_user3",
-                    error_msg=drop_error_msg)
-
-    # Try to DROP (without IF EXISTS) an existing object
-    self.user_query(self.oo_user2_impalad_client, "drop %s %s" %
-                    (test_obj.obj_type, fq_obj_name), user="oo_user2",
-                    error_msg=drop_error_msg)
-    self.user_query(self.oo_user3_impalad_client, "drop %s %s" %
-                    (test_obj.obj_type, obj_name), user="oo_user3",
-                    error_msg=drop_error_msg)
-    # oo_user1 has the privileges to drop the object, so the next query drops it
-    self.user_query(self.oo_user1_impalad_client, "drop %s %s" %
-                    (test_obj.obj_type, obj_name), user="oo_user1")
-
-    # a drop if exists on a non-existing object should not error out if the user has
-    # minimum set of privileges required to list those object types
-    self.user_query(self.oo_user1_impalad_client, "drop %s if exists %s" %
-                    (test_obj.obj_type, obj_name), user="oo_user1")
-    self.user_query(self.oo_user3_impalad_client, "drop %s if exists %s" %
-                    (test_obj.obj_type, obj_name), user="oo_user3")
-    # oo_user2 does not have privileges on this object and hence should receive a
-    # authorization error.
-    error_msg = \
-        "does not have privileges to ANY" if test_obj.obj_type == TestObject.FUNCTION \
-        else "does not have privileges to access"
-    self.user_query(self.oo_user2_impalad_client, "drop %s if exists %s" %
-                    (test_obj.obj_type, fq_obj_name), user="oo_user2",
-                    error_msg=error_msg)
-
-  @pytest.mark.execute_serially
-  @SentryCacheTestSuite.with_args(
-      impalad_args="--server_name=server1 --sentry_config={0} "
-                   "--authorization_policy_provider_class="
-                   "org.apache.impala.testutil.TestSentryResourceAuthorizationProvider"
-                   .format(SENTRY_CONFIG_FILE_OO),
-      catalogd_args="--sentry_config={0} --sentry_catalog_polling_frequency_s={1} "
-                    "--authorization_policy_provider_class="
-                    "org.apache.impala.testutil.TestSentryResourceAuthorizationProvider"
-                    .format(SENTRY_CONFIG_FILE_OO, SENTRY_LONG_POLLING_FREQUENCY_S),
-      sentry_config=SENTRY_CONFIG_FILE_OO,
-      sentry_log_dir="{0}/test_owner_privileges_with_grant".format(SENTRY_BASE_LOG_DIR))
-  def test_owner_privileges_with_grant(self, vector, unique_database):
-    """Tests owner privileges with grant on database, table, and view.
-    - refresh_authorization=True: With Sentry refresh to make sure privileges are really
-                                  stored in Sentry.
-    - refresh_authorization=False: No Sentry refresh to make sure user can use owner
-                                   privileges right away without a Sentry refresh."""
-    for refresh in [True, False]:
-      try:
-        self._setup_ownership_test()
-        self._execute_owner_privilege_tests(TestObject(TestObject.DATABASE,
-                                                       "owner_priv_db",
-                                                       grant=True),
-                                            refresh_authorization=refresh)
-        self._execute_owner_privilege_tests(TestObject(TestObject.TABLE,
-                                                       unique_database +
-                                                       ".owner_priv_tbl",
-                                                       grant=True),
-                                            refresh_authorization=refresh)
-        self._execute_owner_privilege_tests(TestObject(TestObject.VIEW,
-                                                       unique_database +
-                                                       ".owner_priv_view",
-                                                       grant=True),
-                                            refresh_authorization=refresh)
-      finally:
-        self._cleanup_ownership_test()
-
-  def _execute_owner_privilege_tests(self, test_obj, refresh_authorization):
-    """
-    Executes all the statements required to validate owner privileges work correctly
-    for a specific database, table, or view.
-    """
-    # Create object and ensure oo_user1 gets owner privileges.
-    self.oo_user1_impalad_client = self.create_impala_client()
-    # oo_user2 is only used for transferring ownership.
-    self.oo_user2_impalad_client = self.create_impala_client()
-    self.user_query(self.oo_user1_impalad_client, "create %s if not exists %s %s %s" %
-                    (test_obj.obj_type, test_obj.obj_name, test_obj.table_def,
-                     test_obj.view_select), user="oo_user1")
-    self.validate_privileges(self.oo_user1_impalad_client, "show grant user oo_user1",
-                             test_obj, user="oo_user1",
-                             refresh_authorization=refresh_authorization)
-
-    # Ensure grant works.
-    self.user_query(self.oo_user1_impalad_client,
-                    "grant all on %s %s to role owner_priv_test_all_role" %
-                    (test_obj.grant_name, test_obj.obj_name), user="oo_user1")
-    self.user_query(self.oo_user1_impalad_client,
-                    "revoke all on %s %s from role owner_priv_test_all_role" %
-                    (test_obj.grant_name, test_obj.obj_name), user="oo_user1")
-
-    # Change the database owner and ensure oo_user1 does not have owner privileges.
-    self.user_query(self.oo_user1_impalad_client, "alter %s %s set owner user oo_user2" %
-                    (test_obj.obj_type, test_obj.obj_name), user="oo_user1")
-    assert self._validate_no_user_privileges(self.oo_user1_impalad_client,
-                                             user="oo_user1",
-                                             refresh_authorization=refresh_authorization)
-
-    # Ensure oo_user1 cannot drop database after owner change.
-    self.user_query(self.oo_user1_impalad_client, "drop %s %s" %
-                    (test_obj.obj_type, test_obj.obj_name), user="oo_user1",
-                    error_msg="does not have privileges to execute 'DROP'")
-
-    # oo_user2 should have privileges for object now.
-    self.validate_privileges(self.oo_user2_impalad_client, "show grant user oo_user2",
-                             test_obj, user="oo_user2",
-                             refresh_authorization=refresh_authorization)
-
-    # Change the owner to a role and ensure oo_user2 doesn't have privileges.
-    # Set the owner back to oo_user1 since for views, oo_user2 doesn't have select
-    # privileges on the underlying table.
-    self.execute_query("alter %s %s set owner user oo_user1" %
-                       (test_obj.obj_type, test_obj.obj_name),
-                       query_options={"sync_ddl": 1})
-    assert self._validate_no_user_privileges(self.oo_user2_impalad_client,
-                                             user="oo_user2",
-                                             refresh_authorization=refresh_authorization)
-    self.user_query(self.oo_user1_impalad_client,
-                    "alter %s %s set owner role owner_priv_test_owner_role" %
-                    (test_obj.obj_type, test_obj.obj_name), user="oo_user1")
-    # Ensure oo_user1 does not have user privileges.
-    assert self._validate_no_user_privileges(self.oo_user1_impalad_client,
-                                             user="oo_user1",
-                                             refresh_authorization=refresh_authorization)
-
-    # Ensure role has owner privileges.
-    self.validate_privileges(self.oo_user1_impalad_client,
-                             "show grant role owner_priv_test_owner_role", test_obj,
-                             user="oo_user1", refresh_authorization=refresh_authorization)
-
-    # Drop the object and ensure no role privileges.
-    self.user_query(self.oo_user1_impalad_client, "drop %s %s " %
-                    (test_obj.obj_type, test_obj.obj_name), user="oo_user1")
-    assert self._validate_no_user_privileges(self.oo_user1_impalad_client,
-                                             user="oo_user1",
-                                             refresh_authorization=refresh_authorization)
-
-    # Ensure user privileges are gone after drop.
-    self.user_query(self.oo_user1_impalad_client, "create %s if not exists %s %s %s" %
-                    (test_obj.obj_type, test_obj.obj_name, test_obj.table_def,
-                     test_obj.view_select), user="oo_user1")
-    self.user_query(self.oo_user1_impalad_client, "drop %s %s " %
-                    (test_obj.obj_type, test_obj.obj_name), user="oo_user1")
-    assert self._validate_no_user_privileges(self.oo_user1_impalad_client,
-                                             user="oo_user1",
-                                             refresh_authorization=refresh_authorization)
-
-  @pytest.mark.execute_serially
-  @SentryCacheTestSuite.with_args(
-      impalad_args="--server_name=server1 --sentry_config={0} "
-                   "--authorization_policy_provider_class="
-                   "org.apache.impala.testutil.TestSentryResourceAuthorizationProvider"
-                   .format(SENTRY_CONFIG_FILE_NO_OO),
-      catalogd_args="--sentry_config={0} --authorization_policy_provider_class="
-                    "org.apache.impala.testutil.TestSentryResourceAuthorizationProvider"
-                    .format(SENTRY_CONFIG_FILE_NO_OO),
-      sentry_config=SENTRY_CONFIG_FILE_NO_OO,
-      sentry_log_dir="{0}/test_owner_privileges_disabled".format(SENTRY_BASE_LOG_DIR))
-  def test_owner_privileges_disabled(self, vector, unique_database):
-    """Tests that there should not be owner privileges."""
-    try:
-      self._setup_ownership_test()
-      self._execute_owner_privilege_tests_no_oo(TestObject(TestObject.DATABASE,
-                                                           "owner_priv_db"))
-      self._execute_owner_privilege_tests_no_oo(TestObject(TestObject.TABLE,
-                                                           unique_database +
-                                                           ".owner_priv_tbl"))
-      self._execute_owner_privilege_tests_no_oo(TestObject(TestObject.VIEW,
-                                                           unique_database +
-                                                           ".owner_priv_view"))
-    finally:
-      self._cleanup_ownership_test()
-
-  def _execute_owner_privilege_tests_no_oo(self, test_obj):
-    """
-    Executes all the statements required to validate owner privileges work correctly
-    for a specific database, table, or view.
-    """
-    # Create object and ensure oo_user1 gets owner privileges.
-    self.oo_user1_impalad_client = self.create_impala_client()
-    self.user_query(self.oo_user1_impalad_client, "create %s if not exists %s %s %s"
-                    % (test_obj.obj_type, test_obj.obj_name, test_obj.table_def,
-                       test_obj.view_select), user="oo_user1")
-
-    # Ensure grant doesn't work.
-    self.user_query(self.oo_user1_impalad_client,
-                    "grant all on %s %s to role owner_priv_test_all_role" %
-                    (test_obj.grant_name, test_obj.obj_name), user="oo_user1",
-                    error_msg="does not have privileges to execute: GRANT_PRIVILEGE")
-
-    self.user_query(self.oo_user1_impalad_client,
-                    "revoke all on %s %s from role owner_priv_test_all_role" %
-                    (test_obj.grant_name, test_obj.obj_name), user="oo_user1",
-                    error_msg="does not have privileges to execute: REVOKE_PRIVILEGE")
-
-    # Ensure changing the database owner doesn't work.
-    self.user_query(self.oo_user1_impalad_client,
-                    "alter %s %s set owner user oo_user2" %
-                    (test_obj.obj_type, test_obj.obj_name), user="oo_user1",
-                    error_msg="does not have privileges with 'GRANT OPTION'")
-
-    # Ensure oo_user1 cannot drop database.
-    self.user_query(self.oo_user1_impalad_client, "drop %s %s" %
-                    (test_obj.obj_type, test_obj.obj_name), user="oo_user1",
-                    error_msg="does not have privileges to execute 'DROP'")
-
-  @pytest.mark.execute_serially
-  @SentryCacheTestSuite.with_args(
-      impalad_args="--server_name=server1 --sentry_config={0} "
-                   "--authorization_policy_provider_class="
-                   "org.apache.impala.testutil.TestSentryResourceAuthorizationProvider"
-                   .format(SENTRY_CONFIG_FILE_OO_NOGRANT),
-      catalogd_args="--sentry_config={0} --sentry_catalog_polling_frequency_s={1} "
-                    "--authorization_policy_provider_class="
-                    "org.apache.impala.testutil.TestSentryResourceAuthorizationProvider"
-                    .format(SENTRY_CONFIG_FILE_OO_NOGRANT,
-                            SENTRY_LONG_POLLING_FREQUENCY_S),
-      sentry_config=SENTRY_CONFIG_FILE_OO_NOGRANT,
-      sentry_log_dir="{0}/test_owner_privileges_without_grant"
-                     .format(SENTRY_BASE_LOG_DIR))
-  def test_owner_privileges_without_grant(self, vector, unique_database):
-    """Tests owner privileges without grant on database, table, and view.
-    - refresh_authorization=True: With Sentry refresh to make sure privileges are really
-                                  stored in Sentry.
-    - refresh_authorization=False: No Sentry refresh to make sure user can use owner
-                                   privileges right away without a Sentry refresh."""
-    for refresh in [True, False]:
-      try:
-        self._setup_ownership_test()
-        self._execute_owner_privilege_tests_oo_nogrant(TestObject(TestObject.DATABASE,
-                                                                  "owner_priv_db"),
-                                                       refresh_authorization=refresh)
-        self._execute_owner_privilege_tests_oo_nogrant(TestObject(TestObject.TABLE,
-                                                                  unique_database +
-                                                                  ".owner_priv_tbl"),
-                                                       refresh_authorization=refresh)
-        self._execute_owner_privilege_tests_oo_nogrant(TestObject(TestObject.VIEW,
-                                                                  unique_database +
-                                                                  ".owner_priv_view"),
-                                                       refresh_authorization=refresh)
-      finally:
-        self._cleanup_ownership_test()
-
-  def _execute_owner_privilege_tests_oo_nogrant(self, test_obj, refresh_authorization):
-    """
-    Executes all the statements required to validate owner privileges work correctly
-    for a specific database, table, or view.
-    """
-    # Create object and ensure oo_user1 gets owner privileges.
-    self.oo_user1_impalad_client = self.create_impala_client()
-    self.user_query(self.oo_user1_impalad_client, "create %s if not exists %s %s %s" %
-                    (test_obj.obj_type, test_obj.obj_name, test_obj.table_def,
-                     test_obj.view_select), user="oo_user1")
-    self.validate_privileges(self.oo_user1_impalad_client, "show grant user oo_user1",
-                             test_obj, user="oo_user1",
-                             refresh_authorization=refresh_authorization)
-
-    # Ensure grant doesn't work.
-    self.user_query(self.oo_user1_impalad_client,
-                    "grant all on %s %s to role owner_priv_test_all_role" %
-                    (test_obj.grant_name, test_obj.obj_name), user="oo_user1",
-                    error_msg="does not have privileges to execute: GRANT_PRIVILEGE")
-
-    self.user_query(self.oo_user1_impalad_client,
-                    "revoke all on %s %s from role owner_priv_test_all_role" %
-                    (test_obj.grant_name, test_obj.obj_name), user="oo_user1",
-                    error_msg="does not have privileges to execute: REVOKE_PRIVILEGE")
-
-    self.user_query(self.oo_user1_impalad_client, "alter %s %s set owner user oo_user2" %
-                    (test_obj.obj_type, test_obj.obj_name), user="oo_user1",
-                    error_msg="does not have privileges with 'GRANT OPTION'")
-
-    # Use a delay to avoid cache consistency issue that could occur after alter.
-    self.user_query(self.oo_user1_impalad_client, "drop %s %s " %
-                    (test_obj.obj_type, test_obj.obj_name), user="oo_user1")
-    assert self._validate_no_user_privileges(self.oo_user1_impalad_client,
-                                             user="oo_user1",
-                                             refresh_authorization=refresh_authorization)
-
-  @pytest.mark.execute_serially
-  @SentryCacheTestSuite.with_args(
-    impalad_args="--server_name=server1 --sentry_config={0} "
-                 "--authorization_policy_provider_class="
-                 "org.apache.impala.testutil.TestSentryResourceAuthorizationProvider"
-                 .format(SENTRY_CONFIG_FILE_OO),
-    catalogd_args="--sentry_config={0} "
-                  "--authorization_policy_provider_class="
-                  "org.apache.impala.testutil.TestSentryResourceAuthorizationProvider"
-                  .format(SENTRY_CONFIG_FILE_OO),
-    sentry_config=SENTRY_CONFIG_FILE_OO,
-    sentry_log_dir="{0}/test_owner_privileges_different_cases"
-                   .format(SENTRY_BASE_LOG_DIR))
-  def test_owner_privileges_different_cases(self, vector, unique_database):
-    """IMPALA-7742: Tests that only user names that differ only in case are not
-    authorized to access the database/table/view unless the user is the owner."""
-    # Use two different clients so that the sessions will use two different user names.
-    foobar_impalad_client = self.create_impala_client()
-    FOOBAR_impalad_client = self.create_impala_client()
-    role_name = "owner_priv_diff_cases_role"
-    try:
-      self.execute_query("create role %s" % role_name)
-      self.execute_query("grant role %s to group foobar" % role_name)
-      self.execute_query("grant all on server to role %s" % role_name)
-
-      self.user_query(foobar_impalad_client, "create database %s_db" %
-                      unique_database, user="foobar")
-      # FOOBAR user should not be allowed to create a table in the foobar's database.
-      self.user_query(FOOBAR_impalad_client, "create table %s_db.test_tbl(i int)" %
-                      unique_database, user="FOOBAR",
-                      error_msg="User 'FOOBAR' does not have privileges to execute "
-                                "'CREATE' on: %s_db" % unique_database)
-
-      self.user_query(foobar_impalad_client, "create table %s.owner_case_tbl(i int)" %
-                      unique_database, user="foobar")
-      # FOOBAR user should not be allowed to select foobar's table.
-      self.user_query(FOOBAR_impalad_client, "select * from %s.owner_case_tbl" %
-                      unique_database, user="FOOBAR",
-                      error_msg="User 'FOOBAR' does not have privileges to execute "
-                                "'SELECT' on: %s.owner_case_tbl" % unique_database)
-
-      self.user_query(foobar_impalad_client,
-                      "create view %s.owner_case_view as select 1" % unique_database,
-                      user="foobar")
-      # FOOBAR user should not be allowed to select foobar's view.
-      self.user_query(FOOBAR_impalad_client, "select * from %s.owner_case_view" %
-                      unique_database, user="FOOBAR",
-                      error_msg="User 'FOOBAR' does not have privileges to execute "
-                                "'SELECT' on: %s.owner_case_view" % unique_database)
-
-      # FOOBAR user should not be allowed to see foobar's privileges.
-      self.user_query(FOOBAR_impalad_client, "show grant user foobar", user="FOOBAR",
-                      error_msg="User 'FOOBAR' does not have privileges to access the "
-                                "requested policy metadata")
-    finally:
-      self.user_query(foobar_impalad_client, "drop database %s_db cascade" %
-                      unique_database, user="foobar")
-      self.execute_query("drop role %s" % role_name)
diff --git a/tests/authorization/test_sentry.py b/tests/authorization/test_sentry.py
index b019b93..194a249 100644
--- a/tests/authorization/test_sentry.py
+++ b/tests/authorization/test_sentry.py
@@ -31,59 +31,6 @@ SENTRY_CONFIG_FILE = SENTRY_CONFIG_DIR + 'sentry-site.xml'
 @SkipIf.sentry_disabled
 class TestSentry(CustomClusterTestSuite):
   """This class contains Sentry specific authorization tests."""
-  @pytest.mark.execute_serially
-  @CustomClusterTestSuite.with_args(
-      impalad_args="--server_name=server1 --sentry_config={0} "
-                   "--authorization_policy_provider_class="
-                   "org.apache.impala.testutil.TestSentryResourceAuthorizationProvider"
-                   .format(SENTRY_CONFIG_FILE),
-      catalogd_args="--sentry_config={0} "
-                    "--authorization_policy_provider_class="
-                    "org.apache.impala.testutil.TestSentryResourceAuthorizationProvider"
-                    .format(SENTRY_CONFIG_FILE).format(SENTRY_CONFIG_FILE))
-
-  def test_sentry_admin(self, unique_role, unique_name):
-    """
-    Tests that only admin user can execute certain authorization statements.
-    """
-    admin = getuser()
-    # doesnot_exist user does not exist.
-    doesnot_exist = unique_name
-    # root user exists but is not a Sentry admin.
-    non_admin = "root"
-    admin_client = self.create_impala_client()
-    doesntexist_client = self.create_impala_client()
-    root_client = self.create_impala_client()
-    try:
-      self.execute_query_expect_success(admin_client,
-                                        "create role {0}".format(unique_role),
-                                        user=admin)
-
-      # show current roles is always allowed.
-      self.execute_query_expect_success(admin_client, "show current roles", user=admin)
-      self.execute_query_expect_success(doesntexist_client, "show current roles",
-                                        user=doesnot_exist)
-      self.execute_query_expect_success(root_client, "show current roles",
-                                        user=non_admin)
-
-      for statement in ["show roles",
-                        "show grant role {0}".format(unique_role)]:
-        self.execute_query_expect_success(admin_client, statement, user=admin)
-        # doesnotexist user does not exist.
-        result = self.execute_query_expect_failure(doesntexist_client, statement,
-                                                   user=doesnot_exist)
-
-        assert "AuthorizationException: User '{0}' does not have privileges to access " \
-               "the requested policy metadata.".format(doesnot_exist) in str(result)
-
-        # root user exists, but is not a Sentry admin.
-        result = self.execute_query_expect_failure(root_client, statement,
-                                                   user=non_admin)
-        assert "AuthorizationException: User '{0}' does not have privileges to access " \
-               "the requested policy metadata.".format(non_admin) in str(result)
-
-    finally:
-      admin_client.execute("drop role {0}".format(unique_role))
 
   @pytest.mark.execute_serially
   @SentryCacheTestSuite.with_args(
diff --git a/tests/authorization/test_show_grant.py b/tests/authorization/test_show_grant.py
deleted file mode 100644
index 2c824ca..0000000
--- a/tests/authorization/test_show_grant.py
+++ /dev/null
@@ -1,150 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-# Client tests for SQL statement authorization
-# These tests verify the functionality of SHOW GRANT ROLE/USER. We
-# create several users and groups to verify clear separation.
-
-import grp
-import pytest
-from getpass import getuser
-from os import getenv
-
-from impala.dbapi import connect as impala_connect
-from tests.common.test_dimensions import create_uncompressed_text_dimension
-from tests.common.custom_cluster_test_suite import CustomClusterTestSuite
-from tests.common.skip import SkipIf
-
-SENTRY_CONFIG_FILE = getenv('IMPALA_HOME') + \
-    '/fe/src/test/resources/sentry-site_oo.xml'
-
-
-@SkipIf.sentry_disabled
-class TestShowGrant(CustomClusterTestSuite):
-  @classmethod
-  def add_test_dimensions(cls):
-    super(TestShowGrant, cls).add_test_dimensions()
-    cls.ImpalaTestMatrix.add_dimension(
-        create_uncompressed_text_dimension(cls.get_workload()))
-
-  @classmethod
-  def get_workload(cls):
-    return 'functional-query'
-
-  def setup_method(self, method):
-    super(TestShowGrant, self).setup_method(method)
-    self.__test_cleanup()
-
-  def teardown_method(self, method):
-    self.__test_cleanup()
-    self.client.execute('drop role sgu_test_admin')
-    super(TestShowGrant, self).teardown_method(method)
-
-  def __test_cleanup(self):
-    # Clean up any old roles created by this test
-    for role_name in self.client.execute('show roles').data:
-      if 'sgu_test' in role_name:
-        self.client.execute('drop role %s' % role_name)
-
-    # Cleanup any other roles that were granted to this user.
-    # TODO: Update Sentry Service config and authorization tests to use LocalGroupMapping
-    # for resolving users -> groups. This way we can specify custom test users that don't
-    # actually exist in the system.
-    group_name = grp.getgrnam(getuser()).gr_name
-    for role_name in self.client.execute('show role grant group `%s`' % group_name).data:
-      self.client.execute('drop role %s' % role_name)
-
-    # Create a temporary admin user so we can actually view/clean up the test db.
-    self.client.execute('create role sgu_test_admin')
-    self.client.execute('grant all on server to sgu_test_admin')
-    self.client.execute('grant role sgu_test_admin to group `%s`'
-        % group_name)
-
-  @classmethod
-  def restart_first_impalad(cls):
-    impalad = cls.cluster.impalads[0]
-    impalad.restart()
-    cls.client = impalad.service.create_beeswax_client()
-
-  @pytest.mark.execute_serially
-  @CustomClusterTestSuite.with_args(
-    impalad_args='--server_name=server1 --authorization_policy_provider_class='
-                 'org.apache.impala.testutil.TestSentryResourceAuthorizationProvider '
-                 '--sentry_config={0}'.format(SENTRY_CONFIG_FILE),
-    catalogd_args='--sentry_config={0} --authorization_policy_provider_class='
-                  'org.apache.impala.testutil.TestSentryResourceAuthorizationProvider'
-                  .format(SENTRY_CONFIG_FILE),
-    sentry_config=SENTRY_CONFIG_FILE)
-  def test_show_grant_user(self, vector, unique_database):
-    group_name = grp.getgrnam(getuser()).gr_name
-    self.client.execute('create role sgu_test_primary')
-    self.client.execute('grant all on server to sgu_test_primary')
-    self.client.execute('grant role sgu_test_primary to group `%s`' % group_name)
-    self.run_test_case('QueryTest/show_grant_user', vector, use_db=unique_database)
-
-  @pytest.mark.execute_serially
-  @CustomClusterTestSuite.with_args(
-    impalad_args='--server_name=server1 --authorization_policy_provider_class='
-                 'org.apache.impala.testutil.TestSentryResourceAuthorizationProvider '
-                 '--sentry_config={0}'.format(SENTRY_CONFIG_FILE),
-    catalogd_args='--sentry_config={0} --authorization_policy_provider_class='
-                  'org.apache.impala.testutil.TestSentryResourceAuthorizationProvider'
-                  .format(SENTRY_CONFIG_FILE),
-    sentry_config=SENTRY_CONFIG_FILE)
-  def test_show_grant_in_hs2(self, vector, unique_database):
-    """IMPALA-7701: Test that all types in show grant commands are correct. Incorrect
-    types can result in null/None values."""
-    role = 'sgu_test_primary'
-    self.client.execute('create role %s' % role)
-    self.client.execute('grant all on database %s to role %s' % (unique_database, role))
-    default_impalad = pytest.config.option.impalad.split(',')[0]
-    impalad_host = default_impalad.split(':')[0]
-    impalad_hs2_port = pytest.config.option.impalad_hs2_port
-    with impala_connect(host=impalad_host, port=impalad_hs2_port) as conn:
-      cursor = conn.cursor()
-
-      cursor.execute('show grant user %s on database %s' % (getuser(), unique_database))
-      rows = cursor.fetchall()
-      assert len(rows) == 1
-      cols = rows[0]
-      assert len(cols) == 10
-      assert cols[0] == 'USER'  # principal_type
-      assert cols[1] == getuser()  # principal_name
-      assert cols[2] == 'database'  # scope
-      assert cols[3] == unique_database  # database
-      assert cols[4] == ''  # table
-      assert cols[5] == ''  # column
-      assert cols[6] == ''  # uri
-      assert cols[7] == 'owner'  # privilege
-      assert cols[8]  # grant_option
-      # We don't assert create_time since the value can be None or str depending on the
-      # Sentry refresh.
-
-      cursor.execute('show grant role %s on database %s' % (role, unique_database))
-      rows = cursor.fetchall()
-      assert len(rows) == 1
-      cols = rows[0]
-      assert len(cols) == 8
-      assert cols[0] == 'database'  # scope
-      assert cols[1] == unique_database  # database
-      assert cols[2] == ''  # table
-      assert cols[3] == ''  # column
-      assert cols[4] == ''  # uri
-      assert cols[5] == 'all'  # privilege
-      assert not cols[6]  # grant_option
-      # We don't assert create_time since the value can be None or str depending on the
-      # Sentry refresh.