Repository: incubator-sentry Updated Branches: refs/heads/master 14a86ba9b -> bdb11123b
SENTRY-420: TestMovingtoProduction fails on real cluster (Sravya Tirukkovalur via Prasad Mujumdar) Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/bdb11123 Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/bdb11123 Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/bdb11123 Branch: refs/heads/master Commit: bdb11123b989cd97aa7ca14aba099b9343025e14 Parents: 14a86ba Author: Prasad Mujumdar <[email protected]> Authored: Fri Sep 12 10:31:52 2014 -0700 Committer: Prasad Mujumdar <[email protected]> Committed: Fri Sep 12 10:31:52 2014 -0700 ---------------------------------------------------------------------- .../tests/e2e/hive/TestMovingToProduction.java | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/bdb11123/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestMovingToProduction.java ---------------------------------------------------------------------- diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestMovingToProduction.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestMovingToProduction.java index c1a8d91..6fad40d 100644 --- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestMovingToProduction.java +++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestMovingToProduction.java @@ -43,7 +43,9 @@ public class TestMovingToProduction extends AbstractTestWithStaticConfiguration FileOutputStream to = new FileOutputStream(dataFile); Resources.copy(Resources.getResource(SINGLE_TYPE_DATA_FILE_NAME), to); to.close(); - policyFile = PolicyFile.setAdminOnServer1(ADMINGROUP); + policyFile = PolicyFile.setAdminOnServer1(ADMINGROUP) + .setUserGroupMapping(StaticUserGroup.getStaticMapping()); + writePolicyFile(policyFile); } /** @@ -64,15 +66,7 @@ public class TestMovingToProduction extends AbstractTestWithStaticConfiguration */ @Test public void testMovingTable1() throws Exception { - policyFile - .addRolesToGroup(USERGROUP1, "all_db1", "load_data") - .addPermissionsToRole("load_data", "server=server1->uri=file://" + dataDir.getPath()) - .addPermissionsToRole("all_db1", "server=server1->db=" + DB1) - .setUserGroupMapping(StaticUserGroup.getStaticMapping()); - writePolicyFile(policyFile); - String tableName1 = "tb_1"; - Connection connection = context.createConnection(ADMIN1); Statement statement = context.createStatement(connection); statement.execute("DROP DATABASE IF EXISTS " + DB1 + " CASCADE"); @@ -85,6 +79,13 @@ public class TestMovingToProduction extends AbstractTestWithStaticConfiguration statement.close(); connection.close(); + policyFile + .addRolesToGroup(USERGROUP1, "all_db1", "load_data") + .addPermissionsToRole("load_data", "server=server1->uri=file://" + dataDir.getPath()) + .addPermissionsToRole("all_db1", "server=server1->db=" + DB1); + writePolicyFile(policyFile); + + // a connection = context.createConnection(USER1_1); statement = context.createStatement(connection); @@ -146,13 +147,6 @@ public class TestMovingToProduction extends AbstractTestWithStaticConfiguration */ @Test public void testMovingTable2() throws Exception { - policyFile - .addRolesToGroup(USERGROUP1, "all_db1", "load_data") - .addPermissionsToRole("all_db1", "server=server1->db=" + DB1) - .addPermissionsToRole("load_data", "server=server1->uri=file://" + dataDir.getPath()) - .setUserGroupMapping(StaticUserGroup.getStaticMapping()); - writePolicyFile(policyFile); - String tableName1 = "tb_1"; Connection connection = context.createConnection(ADMIN1); Statement statement = context.createStatement(connection); @@ -166,6 +160,12 @@ public class TestMovingToProduction extends AbstractTestWithStaticConfiguration statement.close(); connection.close(); + policyFile + .addRolesToGroup(USERGROUP1, "all_db1", "load_data") + .addPermissionsToRole("all_db1", "server=server1->db=" + DB1) + .addPermissionsToRole("load_data", "server=server1->uri=file://" + dataDir.getPath()); + writePolicyFile(policyFile); + // a connection = context.createConnection(USER1_1); statement = context.createStatement(connection);
