incubator-bigtop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject svn commit: r1371456 - /incubator/bigtop/branches/branch-0.4/bigtop-tests/test-artifacts/hive/src/main/groovy/org/apache/bigtop/itest/hivesmoke/TestJdbcDriver.java
Date Thu, 09 Aug 2012 20:35:02 GMT
Author: rvs
Date: Thu Aug  9 20:35:01 2012
New Revision: 1371456

URL: http://svn.apache.org/viewvc?rev=1371456&view=rev
Log:
BIGTOP-678. Make hive TestJdbcDriver more robust (Wing Yew Poon via Bruno Mahé)

Modified:
    incubator/bigtop/branches/branch-0.4/bigtop-tests/test-artifacts/hive/src/main/groovy/org/apache/bigtop/itest/hivesmoke/TestJdbcDriver.java

Modified: incubator/bigtop/branches/branch-0.4/bigtop-tests/test-artifacts/hive/src/main/groovy/org/apache/bigtop/itest/hivesmoke/TestJdbcDriver.java
URL: http://svn.apache.org/viewvc/incubator/bigtop/branches/branch-0.4/bigtop-tests/test-artifacts/hive/src/main/groovy/org/apache/bigtop/itest/hivesmoke/TestJdbcDriver.java?rev=1371456&r1=1371455&r2=1371456&view=diff
==============================================================================
--- incubator/bigtop/branches/branch-0.4/bigtop-tests/test-artifacts/hive/src/main/groovy/org/apache/bigtop/itest/hivesmoke/TestJdbcDriver.java
(original)
+++ incubator/bigtop/branches/branch-0.4/bigtop-tests/test-artifacts/hive/src/main/groovy/org/apache/bigtop/itest/hivesmoke/TestJdbcDriver.java
Thu Aug  9 20:35:01 2012
@@ -48,7 +48,7 @@ public class TestJdbcDriver {
   private Connection con;
 
   @BeforeClass
-    public static void setUp() throws ClassNotFoundException, InterruptedException {
+  public static void setUp() throws ClassNotFoundException, InterruptedException {
     Class.forName(driverName);
     sh.exec("hadoop fs -mkdir " + testDir);
     assertTrue("Could not create test directory", sh.getRet() == 0);
@@ -57,7 +57,15 @@ public class TestJdbcDriver {
     // start hiveserver in background and remember the pid
     sh.exec("(HIVE_PORT=10000 hive --service hiveserver > /dev/null 2>&1 &
echo $! ) 2> /dev/null");
     hiveserver_pid = sh.getOut().get(0);
-    Thread.sleep(1000); // allow time for hiveserver to be up
+    String hiveserver_startup_wait = System.getProperty("hiveserver.startup.wait");
+    int wait;
+    try {
+      wait = Integer.parseInt(hiveserver_startup_wait);
+    }
+    catch (Exception e) {
+      wait = 1000; // default
+    }
+    Thread.sleep(wait); // allow time for hiveserver to be up
   }
 
   @Before
@@ -80,11 +88,11 @@ public class TestJdbcDriver {
     sh.exec("kill -9 " + hiveserver_pid);
   }
 
-  @Test
+  @Test(timeout=120000L)
   public void testCreate() throws SQLException {
     Statement stmt = con.createStatement();
     String tableName = "hive_jdbc_driver_test";
-    stmt.executeQuery("drop table " + tableName);
+    stmt.executeQuery("drop table if exists " + tableName);
     ResultSet res = stmt.executeQuery("create table " + tableName +
         " (key int, value string)");
     // show tables



Mime
View raw message