HIVE-19532 : fix tests for master-txnstats branch - more tests (Sergey 
Shelukhin)


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

Branch: refs/heads/master
Commit: ba083ed43adb89b738387c900c822548e348ccd0
Parents: 5c8b5d8
Author: sergey <[email protected]>
Authored: Sat Jul 21 13:42:32 2018 -0700
Committer: sergey <[email protected]>
Committed: Sat Jul 21 13:42:32 2018 -0700

----------------------------------------------------------------------
 .../metastore/client/TestAlterPartitions.java   | 26 ++++++++++++++------
 1 file changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/ba083ed4/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestAlterPartitions.java
----------------------------------------------------------------------
diff --git 
a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestAlterPartitions.java
 
b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestAlterPartitions.java
index f3e0ba4..4fc3688 100644
--- 
a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestAlterPartitions.java
+++ 
b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestAlterPartitions.java
@@ -1050,14 +1050,18 @@ public class TestAlterPartitions extends 
MetaStoreClientTest {
     client.renamePartition(DB_NAME, TABLE_NAME, Lists.newArrayList(), 
partToRename);
   }
 
-  @Test(expected = InvalidOperationException.class)
+  @Test
   public void testRenamePartitionNullOldPartList() throws Exception {
     createTable4PartColsParts(client);
     List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, 
(short)-1);
 
     Partition partToRename = oldParts.get(3);
     partToRename.setValues(Lists.newArrayList("2018", "01", "16"));
-    client.renamePartition(DB_NAME, TABLE_NAME, null, partToRename);
+    try {
+      client.renamePartition(DB_NAME, TABLE_NAME, null, partToRename);
+      Assert.fail("should throw");
+    } catch (InvalidOperationException | TProtocolException ex) {
+    }
   }
 
   @Test
@@ -1069,7 +1073,7 @@ public class TestAlterPartitions extends 
MetaStoreClientTest {
       Partition partToRename = oldParts.get(3);
       partToRename.setValues(Lists.newArrayList("2018", "01", "16"));
       client.renamePartition(DB_NAME, TABLE_NAME, oldValues.get(3), null);
-    } catch (NullPointerException | TTransportException e) {
+    } catch (NullPointerException | TProtocolException e) {
     }
   }
 
@@ -1103,24 +1107,32 @@ public class TestAlterPartitions extends 
MetaStoreClientTest {
     client.renamePartition(DB_NAME, "", oldValues.get(3), partToRename);
   }
 
-  @Test(expected = MetaException.class)
+  @Test
   public void testRenamePartitionNullDbName() throws Exception {
     List<List<String>> oldValues = createTable4PartColsParts(client);
     List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, 
(short)-1);
 
     Partition partToRename = oldParts.get(3);
     partToRename.setValues(Lists.newArrayList("2018", "01", "16"));
-    client.renamePartition(null, TABLE_NAME, oldValues.get(3), partToRename);
+    try {
+      client.renamePartition(null, TABLE_NAME, oldValues.get(3), partToRename);
+      Assert.fail("should throw");
+    } catch (MetaException | TProtocolException ex) {
+    }
   }
 
-  @Test(expected = MetaException.class)
+  @Test
   public void testRenamePartitionNullTblName() throws Exception {
     List<List<String>> oldValues = createTable4PartColsParts(client);
     List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, 
(short)-1);
 
     Partition partToRename = oldParts.get(3);
     partToRename.setValues(Lists.newArrayList("2018", "01", "16"));
-    client.renamePartition(DB_NAME, null, oldValues.get(3), partToRename);
+    try {
+      client.renamePartition(DB_NAME, null, oldValues.get(3), partToRename);
+      Assert.fail("should throw");
+    } catch (MetaException | TProtocolException ex) {
+    }
   }
 
   @Test(expected = MetaException.class)

Reply via email to